HaschekSolutions / pictshare

:camera: PictShare is an open source image, mp4, pastebin hosting service with a simple resizing and upload API that you can host yourself. :rice_scene:
https://www.pictshare.net
Apache License 2.0
840 stars 125 forks source link

Upload.php: Return the same JSON Structure for files that are already existing #102

Closed Scarwolf closed 4 years ago

Scarwolf commented 4 years ago

Hey there,

I was integrating Pictshare's API in the Screenshot Tool ShareX and struggling for an hour, wondering why the Script did not return the delete_url param.

Eventually I found out this was related to Sharex Uploading the same file over and over again to test and the /upload endpoint returning a different JSON Structure for files that have been uploaded before.

So I created this PR which returns the Same values as if the file uploaded would not have been uploaded before.

geek-at commented 4 years ago

Sorry but there is a reason that the delete code is only shown for images that are new.

If I would merge your PR then anyone could delete any image just by re-uploading it and receiving the delete code.

The delete code is only given out to the person who first uploads a unique image.

If you're hosting yourself you can add the master delete code that's one delete code for all images

D-Ogi commented 3 years ago

Creating a symlink to a latest existing copy could do the job if there is a some additional logic behind.