Skip to content

Commit

Permalink
Fix delete
Browse files Browse the repository at this point in the history
  • Loading branch information
robrotheram committed Apr 7, 2024
1 parent 06d9d87 commit 27e7daa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion backend/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (api *GoGalleryAPI) ImgHandler(w http.ResponseWriter, r *http.Request) {

func (api *GoGalleryAPI) DashboardAPI() {
headers := handlers.AllowedHeaders([]string{"X-Requested-With", "Content-Type", "Authorization"})
methods := handlers.AllowedMethods([]string{"GET", "POST", "PUT", "HEAD", "OPTIONS"})
methods := handlers.AllowedMethods([]string{"GET", "POST", "PUT", "HEAD", "DELETE", "OPTIONS"})
origins := handlers.AllowedOrigins([]string{"*"})

api.router.PathPrefix("/preview-build").Handler(&home{
Expand Down
6 changes: 1 addition & 5 deletions backend/datastore/picturesCollection.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ func (p *PictureCollection) FindManyFeild(key string, val string) []models.Pictu
func (p *PictureCollection) Delete(picture models.Picture) error {
p.Lock()
defer p.Unlock()

err := os.Remove(picture.Path)
if err != nil {
return err
}
os.Remove(picture.Path)
p.DB.DeleteStruct(&picture)
return nil
}
Expand Down

0 comments on commit 27e7daa

Please sign in to comment.