Opened 13 years ago
Closed 12 years ago
#255 closed defect (fixed)
Cannot delete media page if the file itself had been deleted
Reported by: | Aleksej | Owned by: | Jorge Araya Navarro |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | programming | Keywords: | |
Cc: | Parent Tickets: |
Description (last modified by )
1. Have some media uploaded. 2. Delete the files manually from the user\_dev directory. 3. Try deleting a media through MediaGoblin (I used an "admin" user). Fails with "No such file or directory", shows an error page.
Change History (16)
comment:2 by , 13 years ago
Aleksej Serdjukov wrote: .. raw:: html <del> Fails with "No such file or directory", shows an error page. 4. Try deleting any media (that or other). .. raw:: html </del> Nothing happens at all, redisplays the media page. Sorry, those steps were not meant to be strike-though (there was a "-" before each ">").
comment:3 by , 13 years ago
(I suspect the issue for which I originally filed this ticket was actually from me forgetting to set the "I am sure" checkbox: `http://bugs.foocorp.net/issues/597. <http://bugs.foocorp.net/issues/597.>`_)
comment:4 by , 13 years ago
One simple solution to this is to simply return without doing anything if there's nothing to delete. However that could cause problems of its own... Suggestions on how to handle this pleasantly?
comment:6 by , 13 years ago
The original url for this bug was http://bugs.foocorp.net/issues/590 .
Relations:
#262: related
comment:7 by , 13 years ago
Owner: | set to |
---|---|
Status: | accepted → assigned |
comment:8 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
here is the fix https://gitorious.org/mediagoblin/mediagoblin/merge_requests/37 :D
comment:9 by , 12 years ago
Description: | modified (diff) |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
I'm pretty sure that fix hasn't been applied, so this shouldn't be closed.
Also, there are some issues with that merge request. First, it probably shouldn't have the comments that are there. Second, I think that's not the only reason that an OSError can get kicked up. Is silently doing nothing the right thing to do here? Should a message get logged?
comment:10 by , 12 years ago
Replying to shackra:
here is the fix https://gitorious.org/mediagoblin/mediagoblin/merge_requests/37 :D
This issue seems to have been solved on a bit too low level in the infrastructure.
Fixing it in BasicFileStorage is not desirable since it's basically our interface to the "file systems" we use for storage.
I'd rather we fix it in tools/files.py
's delete_media_files
and user_pages/views.py
's confirm_delete_media
. Make the delete_media_files return the exceptions for all files along with the file name or path and log the errors.
In the view, use messages.add_message to print the errors, but go through with the deletion of the DB entry despite the errors.
comment:11 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | reopened → assigned |
comment:12 by , 12 years ago
I already send a merge request :)
what the user will see:
what the admin will read:
2012-06-28 22:04:04,589 ERROR [mediagoblin.user_pages.views] No such files from the user "test" to delete: media_entries/1/146948.medium.jpg, media_entries/1/146948.thumbnail.jpg, media_entries/1/146948.jpg
I hope this bugfix is ok :D
follow-up: 14 comment:13 by , 12 years ago
Hey Shackra,
This is great! And I think it's almost ready for merge.
I only have one requested change: as per PEP-8, we don't do mixedCase. Could you change:
noSuchFiles = []
to be:
no_such_files = []
In the future, it would be best not to use merge requests and use a feature branch that you link here instead. But anyway, looks good... make that change and I'll merge!
comment:14 by , 12 years ago
Replying to cwebber:
Hey Shackra,
This is great! And I think it's almost ready for merge.
I only have one requested change: as per PEP-8, we don't do mixedCase. Could you change:
noSuchFiles = []to be:
no_such_files = []In the future, it would be best not to use merge requests and use a feature branch that you link here instead. But anyway, looks good... make that change and I'll merge!
DONE! :D
you can merge my code now!!
comment:15 by , 12 years ago
I'm not sure why your comment linked to the uncyclopedia article on viagra instead of the merge request, but I edited your post.
Also, looks like you missed one no_such_files switch, but I got it.
Anyway, merged and pushed! Thank you very much for working on this!
comment:16 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |