bugSamizdat - Bugs: bug #19909, runtime error when editing an...

 
 

bug #19909: runtime error when editing an openly editable non-text media resource of another user

Submitted by:  Boud Roukema <boud>
Submitted on:  Sat 19 May 2007 10:32:03 PM UTC  
 
Category: NoneSeverity: 4 - Important
Status: FixedPrivacy: Public
Assigned to: NoneOpen/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sat 19 May 2007 10:32:03 PM UTC, original submission:

hi samizdat-devel,

Here's a bug which in principle should be corrected, though it's only likely
to annoy users once there is a sufficient number of users who both like
wiki culture for text but also wish to openly edit others' non-text media.

cheers
boud

SUMMARY:
If a user tries to replace a non-text media resource created by another
user as an openly editable resource, then a runtime error occurs. This
can either be two different users with logins, or the first user may be
guest (the anonymous user).

VERSION:
0.6.0.20070509

DESCRIPTION:

1. guest publishes a .png file with status open for editing
-> resource 3098
guest/3098.png created

2. registered user logs in

3. user tries to replace 3098 with a new upload of a .png file
- preview is OK

two files now exist in content/ :
user/upload.png # new file
guest/3098.png # old file

4. confirm
- runtime error occurs after confirm:

Samizdat: No such file or directory - /var/www/samizdat/content/guest/upload.png or /var/www/samizdat/content/guest/3098.png
Exception: Errno::ENOENT
Error ID: 0c908e3c0b5c82f3bd1bd998eeac8f71
CGI parameters: {"confirm"=>["Confirm"], "rating"=>[""], "format"=>["image/png"], "title"=>["guest publishes an image"], "body"=>[""], "focus"=>[""], "action"=>[""], "upload"=>["true"], "desc"=>[""], "lang"=>["en"], "action_token"=>["b9486d36bb6628f97ffb771940415572"], "open"=>["true"]}
Backtrace:
/usr/lib/ruby/1.8/samizdat/models/content.rb:150:in `rename'
/usr/lib/ruby/1.8/samizdat/models/content.rb:150:in `move_upload'
/usr/lib/ruby/1.8/samizdat/controllers/message_controller.rb:168:in `edit'
/usr/lib/ruby/1.8/samizdat/controllers/message_controller.rb:165:in `save'
/usr/lib/ruby/1.8/samizdat/controllers/message_controller.rb:408:in `transaction'
/usr/lib/ruby/1.8/samizdat/controllers/message_controller.rb:408:in `save'
/usr/lib/ruby/1.8/samizdat/controllers/message_controller.rb:165:in `edit'
/usr/lib/ruby/1.8/samizdat/engine/dispatcher.rb:76:in `send'
/usr/lib/ruby/1.8/samizdat/engine/dispatcher.rb:76:in `render'
/usr/lib/ruby/1.8/samizdat/engine/dispatcher.rb:120:in `dispatch'
/usr/lib/ruby/1.8/samizdat/engine/dispatcher.rb:117:in `catch'
/usr/lib/ruby/1.8/samizdat/engine/dispatcher.rb:117:in `dispatch'
/usr/lib/ruby/1.8/samizdat/engine/dispatcher.rb:130:in `run'
/usr/share/samizdat/cgi-bin/dispatch.rb:23
/usr/lib/ruby/1.8/apache/ruby-run.rb:53:in `load'
/usr/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler'

The error message is correct: two files now exist in content/ :
user/upload.png # new file
guest/3099.png # old file was renamed from 3098.png to 3099.png

4. The resource 3098 now has no image at all - the content reproduces
the title.

ATTEMPTED ANALYSIS - KEY LINES IN CODE:

models/content.rb:
class Content
@login
file_path
move_upload
upload_filename

controllers/message_controller.rb:
def edit

if @request.has_key? 'confirm'
check_content
save do
version_id = @message.edit!
@old_content.move_upload(@request, @id, version_id)
@message.content.move_upload(@request) # problem occurs here
end
@request.redirect(@message.id)

######################################################################

Boud Roukema <boud>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by angdraug (Updated the item)
  • -unavailable- added by boud (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 15 Jul 2007 11:03:22 PM UTCboudStatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Sun 20 May 2007 12:19:13 PM UTCangdraugSeverity3 - Normal=>4 - Important
      StatusNone=>In Progress

    Back to the top


    Powered by Savane 3.1-cleanup1