Remove removes single file under public path.
(path string)
| 181 | |
| 182 | // Remove removes single file under public path. |
| 183 | func (g *PublishedStorage) Remove(path string) error { |
| 184 | if g.debug { |
| 185 | log.Debug().Msgf("GCS: Remove '%s'", path) |
| 186 | } |
| 187 | |
| 188 | err := g.objectHandle(path).Delete(context.TODO()) |
| 189 | if err != nil { |
| 190 | if err == storage.ErrObjectNotExist { |
| 191 | return nil |
| 192 | } |
| 193 | |
| 194 | var apiErr *googleapi.Error |
| 195 | if errors.As(err, &apiErr) && apiErr.Code == 404 { |
| 196 | return nil |
| 197 | } |
| 198 | |
| 199 | return errors.Wrap(err, fmt.Sprintf("error deleting %s from %s", path, g)) |
| 200 | } |
| 201 | |
| 202 | delete(g.pathCache, path) |
| 203 | |
| 204 | return nil |
| 205 | } |
| 206 | |
| 207 | // RemoveDirs removes directory structure under public path. |
| 208 | func (g *PublishedStorage) RemoveDirs(path string, _ aptly.Progress) error { |