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

Submitter:  Boud Roukema <boud>
Submitted:  Sat 19 May 2007 10:32:03 PM UTC
   
 
Category:  None Severity:  4 - Important
Status:  Fixed Privacy:  Public
Assigned to:  None Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group Member

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-07-15 boud StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2007-05-20 angdraug Severity3 - Normal 4 - Important
        StatusNone In Progress

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code