unable to store files outside of the database due to maxattachmentsize being used instead of maxlocalattachment

RESOLVED INVALID

Status

()

Bugzilla
Bugzilla-General
RESOLVED INVALID
3 years ago
3 years ago

People

(Reporter: Dragon Park, Assigned: glob)

Tracking

Details

Attachments

(1 attachment)

(Reporter)

Description

3 years ago
User Agent: Mozilla/4.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)

Steps to reproduce:

if I want to store local file above maxlocalattachment than database, but every attached file was stored at the database...



Actual results:

every attached file was stored at the database...


Expected results:

the Bugzilla/Attachment.pm file has a bug at the line 829
I modified the source code as below, then Wanted output made.

maybe this code didn't tested...

828     # The file is too large to be stored in the DB, so we store it locally.
829     # DragonPark<gundalpha@hotmail.com> modified 
830      # if ($size > Bugzilla->params->{'maxattachmentsize'} * 1024) {
831     if ($size > Bugzilla->params->{'maxlocalattachment'} * 1024) {
(Reporter)

Comment 1

3 years ago
After modify the source code of Bugzilla/Attachment.pm , then I can see the local stored file 

/var/www/bugzilla/data/attachments# ls -la
total 16
drwxrwx--- 3 www-data www-data 4096  9월  4 16:25 .
drwxrwx--- 8 www-data www-data 4096  9월  4 16:20 ..
drwxrwx--- 2 www-data www-data 4096  9월  4 16:25 group.19
-rw-r----- 1 www-data www-data  111  6월  4 09:18 .htaccess

/var/www/bugzilla/data/attachments# cd group.19

/var/www/bugzilla/data/attachments/group.19# ls -la
total 11348
drwxrwx--- 2 www-data www-data     4096  9월  4 16:25 .
drwxrwx--- 3 www-data www-data     4096  9월  4 16:25 ..
-rw-r--r-- 1 www-data www-data 11611399  9월  4 16:25 attachment.19
(Assignee)

Comment 2

3 years ago
looks like this has never worked!
Status: UNCONFIRMED → NEW
Depends on: 490930
Ever confirmed: true
Summary: maxattachmentsize → unable to store files outside of the database due to maxattachmentsize being used instead of maxlocalattachment
Version: 4.4.4 → 4.2
(Assignee)

Comment 3

3 years ago
Created attachment 8484018 [details] [diff] [review]
1062746_1.patch

dragon park: thanks for this report.

note maxlocalattachment is in megabytes, while maxattachmentsize is in kilobytes so you have to use a different multiplier.
Assignee: general → glob
Status: NEW → ASSIGNED
Attachment #8484018 - Flags: review?(sgreen)
(Reporter)

Comment 4

3 years ago
Why use 1048576 ???
I think 1024 is enough...
(Assignee)

Comment 5

3 years ago
sorry, i completely miss-read the descriptions of the parameters.
it looks like the current implementation is correct.

maxattachmentsize : the maximum size of attachments to be stored in the db.  files smaller than this will be stored on the local filesystem (if allowed by the maxlocalattachment setting).

maxlocalattachment : the maximum size of attachments to be stored locally (used only when the size of the file is larger than maxattachmentsize).


so checking maxattachmentsize _is_ the correct behaviour.
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → INVALID
(Assignee)

Updated

3 years ago
Attachment #8484018 - Flags: review?(sgreen)
You need to log in before you can comment on or make changes to this bug.