Defect #5969
closedAttachments with size zero are ignored
0%
Description
How to reproduce:
- create file with zero size (for example, in Linux: touch redmine_test_file.txt)
- try to add this file to existing issue
Results:Issue has not any uploaded file
I have Redmine 1.0.0 on Debian Lenny with mongrel and MySQL 5.0
Ruby version 1.8.7 (x86_64-linux)
RubyGems version 1.3.4
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root /var/www/redmine-1.0.0
Database adapter mysql
Database schema version 20100705164950
About your Redmine plugins
Redmine Graphs plugin 0.1.0
Simple CI 1.0
Redmine Charts 0.1.0
Scrumdashboard plugin 1.2
Mylyn Connector plugin 2.6.4.trunk.423
In production.log i can see this:
Processing IssuesController#update (for X.X.X.X at 2010-07-27 08:05:14) [PUT]
Parameters: {"time_entry"=>{"comments"=>"", "activity_id"=>"", "hours"=>""}, "commit"=>"Принять", "notes"=>"", "action"=>"update", "_method"=>"put", "authenticity_token"=>"Kieyq
oJZuBzsxZldQfF/7ijY4Dj4U4EWWDss06SHiSo=", "id"=>"10758", "issue"=>{"start_date"=>"2010-07-26", "custom_field_values"=>{"8"=>"2010-07-27"}, "estimated_hours"=>"", "priority_id"=>"6
", "parent_issue_id"=>"", "lock_version"=>"8", "fixed_version_id"=>"", "done_ratio"=>"0", "assigned_to_id"=>"8", "subject"=>"Test Task ", "category_id"=>"126", "tracker_id"=>"14", "due_date"=>"", "status_id"=>"2", "description"=>"Test Test"}, "controller"=>"issues", "attachments"=>{"1"=>{"file"=>#<File:/tmp/RackMultipart20100727-28985-l0uv9f-0>, "description"=>"test file"}}}
Redirected to http://prj.slweb.ru/issues/10758
Completed in 340ms (DB: 48) | 302 Found [http://prj.slweb.ru/issues/10758/edit]
If i do:
echo 1 > redmine_test_file.txt
then this file can be added successfully.
P.S. Sorry for my English
Thank you!
Files
Related issues
Updated by Felix Schäfer over 14 years ago
If this updates adds an empty file, I can't reproduce the issue.
Updated by Felix Schäfer over 14 years ago
- Subject changed from Could not upload file with zero size into existing issue to Attachments with size zero are ignored
- Category set to Attachments
- Affected version (unused) set to devel
Ok, my precedent note should have included an empty attachment, so I can reproduce this issue.
Updated by Holger Just over 14 years ago
This is because of source:trunk/app/models/attachment.rb#L147
Attachments with size zero are explicitly ignored.
Updated by Felix Schäfer over 14 years ago
Any reason for not uploading null-sized attachments, or on the other hand any reason for wanting to upload null-sized files?
Updated by Yuriy Vidineev over 14 years ago
We want to upload google verification files - files with special name and zero size
Updated by Felix Schäfer over 14 years ago
IIRC google verification files have to live in the root of the URI you want to verify, for that you'd need to put the file in redmine_dir/public/
.
Updated by Yuriy Vidineev over 14 years ago
I may not correctly put. I don't wont to verify my Redmine. I want to verify my another website and add google verification file to task in Redmine. But i can't add this file to task because it has zero size.
P.S. Sorry for my English
Updated by Felix Schäfer over 14 years ago
Well, you could just save the filename in a wiki or wherever, and I think google retains means to download the files even long after they have been activated ;-)
Anyway, Holger, do you see any reason to not allow zero-sized files?
Updated by Holger Just over 14 years ago
I still do not see the point why you would want that. Also, the file you downloaded from google is not a zero byte file. It at least contains the code that is also present in the filename.
But I see no technical reasons why a zero byte file would not be possible, apart from possibly obscure browser bugs of course. Also, I just traced the code back to the initial revision, so we can also safely fall back to "we always did it that way" :) See source:trunk/redmine/app/controllers/documents_controller.rb@4#L46
Updated by Daniel Felix almost 12 years ago
- Status changed from New to Needs feedback
Any news on this? Should this be corrected or is this excluded by design?
Updated by Jean-Philippe Lang almost 12 years ago
- Status changed from Needs feedback to Confirmed
I mark this as confirmed as there's no good reason to ignore empty files.
Updated by Go MAEDA over 9 years ago
- Has duplicate Defect #10312: Can not attach empty files. added
Updated by Stephen Ostrow over 9 years ago
Felix Schäfer wrote:
Any reason for not uploading null-sized attachments, or on the other hand any reason for wanting to upload null-sized files?
Figured I would add another use-case as an example and why I went looking to see if this bug was already filed. Over the past month or so I've been uploading 4 files when running an operation.
- before.txt
- operation.log
- after.txt
- result.diff
Where result.diff is a diff of the before.txt and the after.txt files. When there is no difference then the .diff file is empty (0b) and although I still want it uploaded to show that fact, redmine is silently ignoring the upload.
I personally would like for redmine to upload 0b files since I can't think of a good reason for it not to. But more so I would say it is a bug that it silently ignores the 0b file after showing you that it has been added to the issue.
Updated by Jens Krämer over 8 years ago
Submitted a patch that fixes this in #23718
Updated by Jens Krämer over 8 years ago
- File 0001-allow-upload-of-zero-byte-files-as-attachments.patch 0001-allow-upload-of-zero-byte-files-as-attachments.patch added
attaching the patch here as requested :)
Updated by Jan from Planio www.plan.io over 8 years ago
- Related to Patch #23718: do not ignore zero byte attachments added
Updated by Jan from Planio www.plan.io over 8 years ago
- Target version set to Candidate for next minor release
Updated by Go MAEDA almost 8 years ago
- Related to Patch #25115: Support upload of empty files and fix invalid API response added
Updated by Go MAEDA almost 8 years ago
- Status changed from Confirmed to Closed
- Target version deleted (
Candidate for next minor release) - Resolution set to Fixed
Fixed by #25115 for 3.3.3 and 3.4.0.