Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't upload image over 110k #345

Open
ErixWong opened this issue Apr 8, 2022 · 4 comments
Open

Can't upload image over 110k #345

ErixWong opened this issue Apr 8, 2022 · 4 comments

Comments

@ErixWong
Copy link

ErixWong commented Apr 8, 2022

I running a redmine 4.2.5.stable in docker based on the docker official image. After installed redmine_ckeditor I found pictures over 110k can't be uploaded.

Error Message:
Completed 500 Internal Server Error in 29ms (ActiveRecord: 20.2ms)
TypeError (no implicit conversion of nil into String):
lib/redmine/sudo_mode.rb:61:in `sudo_mode'

Meanwhile I can upload attachments, I also set the limitation of file upload size, but it doesn't work to redmine_ckeditor

I also found small pictures will be uploaded to /tmp first, error ones will not appear in /tmp
I checked the /tmp, it's not full, big enough. I also can download big files manually by redmine:redmine in tmp.

Well, is there any place where this limit can be set? Thanks a lot.

image

@sylvainfaivre
Copy link

I am experiencing the same problem, did you find a solution ?

Environment:
  Redmine version                4.2.5.stable
  Ruby version                   2.6.10-p210 (2022-04-12) [x86_64-linux]
  Rails version                  5.2.6.3
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                sendmail
SCM:
  Git                            2.30.2
  Filesystem                     
Redmine plugins:
  localizable                    0.4.0
  redmine_agile                  1.6.4
  redmine_checklists             3.1.21
  redmine_ckeditor               1.2.3
  redmine_slack                  0.2
  redmine_theme_changer          0.5.0
  redmineup_tags                 2.0.12

@mqu
Copy link

mqu commented Nov 7, 2022

same error here, with Redmine running in docker container when uploading image to ckeditor (POST method in Redmine logs).

We do not have this error when posting same files to tickets attachments.

here is my Redmine environment:

Environment:
  Redmine version                4.2.7.stable
  Ruby version                   2.7.4-p191 (2021-07-07) [x86_64-linux-gnu]
  Rails version                  5.2.8
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Git                            2.30.2
  Filesystem                     
Redmine plugins:
  additionals                    2.0.23-master
  computed_custom_field          1.0.7
  easy_baseline                  1.4
  easy_gantt                     1.12
  easy_gantt_pro                 1.10
  easy_mindmup                   1.2
  easy_wbs                       1.7
  redmine_agile                  1.6.2
  redmine_base_deface            1.3.2
  redmine_checklists             3.1.19
  redmine_ckeditor               1.2.3
  redmine_default_custom_query   1.5.0
  redmine_drawio                 1.4.2
  redmine_gitlab_hook            4.0.0
  redmine_group_manager          0.3.0
  redmine_issue_completion       0.0.2
  redmine_lightbox2              0.5.1
  redmine_maintenance_mode       2.2.0
  redmine_mentions               0.0.1
  redmine_messenger              1.0.5
  redmine_multiprojects_issue    4.1.1
  redmine_omniauth_openid_connect 1.0.1
  redmine_per_project_formatting 0.1.0
  redmine_project_alias_2        1.1.1
  redmine_silencer               0.4.3
  redmine_wiki_issue_fields      0.6.1
  redmine_wiki_lists             0.0.11
  redmineup_tags                 2.0.8
  selectbox_autocompleter        1.2.1

interesting parts from docker-compose.yml

version: "3.6"

services:

  db:
    # image: mariadb 
    # mysql - 8.0.17 (docker inspect)
    image: mysql:8.0.17
    ...

  redmine:
    # local and custom build
    image: redmine:4x-5.0-build-local-custom02
    build:
       context: ./build/redmine
       args:
           REDMINE_VERSION: "4.2.7"
    restart: always
    volumes:
      # many local volumes
    depends_on:
      - db
    links:
      - db
    expose:
      - 3000
    ports:
      - "127.0.0.1:3001:3000"
    networks:
       - private
    mem_swappiness: 0
    deploy:
      resources:
        limits:
          cpus: '5.50'
          memory: 4000M
        reservations:
          memory: 150M

networks:
  private:

from redmine log:
when OK ;

Started POST "/rich/files?authenticity_token=tloDZmUSOGKp4%2BjzdicRv1E2nK4NLE%2FgyoftfcRsZV3s9RW9AOM9KVmfqiCiIxo0VHUNefNvIOkto0co38hwiA%3D%3D&simplified_type=image&scoped=true&scope_type=Project&scope_id=42&qqfile=xcalidraw-02.jpg" for 82.65.230.XX at 2022-11-07 10:25:20 
+0100
Processing by Rich::FilesController#create as */*
  Parameters: {"file"=>#<ActionDispatch::Http::UploadedFile:0x00007f4e935e26b0 @tempfile=#<Tempfile:/tmp/raw-upload.20221107-300957-musvkv>, @original_filename="xcalidraw-02.jpg", @content_type="application/octet-stream", @headers=nil>, "authenticity_token"=>"tloDZmUSOGKp
4+jzdicRv1E2nK4NLE/gyoftfcRsZV3s9RW9AOM9KVmfqiCiIxo0VHUNefNvIOkto0co38hwiA==", "simplified_type"=>"image", "scoped"=>"true", "scope_type"=>"Project", "scope_id"=>"42", "qqfile"=>"xcalidraw-02.jpg"}
  Current user: some.user (id=527)
[paperclip] Trying to link /tmp/raw-upload.20221107-300957-musvkv to /tmp/264a6d190497ecd7a4458552c3029c6c20221107-300957-10s444r.jpg
Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/264a6d190497ecd7a4458552c3029c6c20221107-300957-10s444r.jpg[0]' 2>/dev/null
Command :: identify -format %m '/tmp/264a6d190497ecd7a4458552c3029c6c20221107-300957-10s444r.jpg[0]'
Command :: convert '/tmp/264a6d190497ecd7a4458552c3029c6c20221107-300957-10s444r.jpg[0]' -auto-orient -resize "x100" -crop "100x100+65+0" +repage '/tmp/c089f0933560147a50953f92854b28b320221107-300957-171em4j'
[paperclip] Trying to link /tmp/c089f0933560147a50953f92854b28b320221107-300957-171em4j to /tmp/75d9777d0d7321b333babf240f6aa20520221107-300957-honzrf
Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/264a6d190497ecd7a4458552c3029c6c20221107-300957-10s444r.jpg[0]' 2>/dev/null
Command :: identify -format %m '/tmp/264a6d190497ecd7a4458552c3029c6c20221107-300957-10s444r.jpg[0]'
Command :: convert '/tmp/264a6d190497ecd7a4458552c3029c6c20221107-300957-10s444r.jpg[0]' -auto-orient -resize "x100" -crop "100x100+65+0" +repage '/tmp/c089f0933560147a50953f92854b28b320221107-300957-jaymcq'
[paperclip] Trying to link /tmp/c089f0933560147a50953f92854b28b320221107-300957-jaymcq to /tmp/3ad404c76d261d998aa00f1459488dcf20221107-300957-yato8h
Completed 200 OK in 807ms (Views: 1.6ms | ActiveRecord: 52.4ms)
Started GET "/rich/files/2553" for 82.65.230.72 at 2022-11-07 10:25:21 +0100
Processing by Rich::FilesController#show as */*
  Parameters: {"id"=>"2553"}
  Current user: some.user (id=527)
  Rendering /var/lib/gems/2.7.0/bundler/gems/rich-f5b5b07f10af/app/views/rich/files/show.html.erb
  Rendered plugins/redmine_ckeditor/app/views/rich/files/_file.html.erb (2.1ms)
  Rendered /var/lib/gems/2.7.0/bundler/gems/rich-f5b5b07f10af/app/views/rich/files/show.html.erb (7.3ms)
Completed 200 OK in 48ms (Views: 8.7ms | ActiveRecord: 26.2ms)

redmine log when failling to upload, with image larger than about 135Ko :

Started POST "/rich/files?authenticity_token=tloDZmUSOGKp4%2BjzdicRv1E2nK4NLE%2FgyoftfcRsZV3s9RW9AOM9KVmfqiCiIxo0VHUNefNvIOkto0co38hwiA%3D%3D&simplified_type=image&scoped=true&scope_type=Project&scope_id=42&qqfile=xcalidraw-03.jpg" for 82.65.230.XX at 2022-11-07 10:25:15 
+0100
Processing by Rich::FilesController#create as */*
  Parameters: {"file"=>#<ActionDispatch::Http::UploadedFile:0x00007f4e580c4a10 @tempfile=#<Tempfile:>, @original_filename="xcalidraw-03.jpg", @content_type="application/octet-stream", @headers=nil>, "authenticity_token"=>"tloDZmUSOGKp4+jzdicRv1E2nK4NLE/gyoftfcRsZV3s9RW9AO
M9KVmfqiCiIxo0VHUNefNvIOkto0co38hwiA==", "simplified_type"=>"image", "scoped"=>"true", "scope_type"=>"Project", "scope_id"=>"42", "qqfile"=>"xcalidraw-03.jpg"}
  Current user: some.user (id=527)
Completed 500 Internal Server Error in 25ms (ActiveRecord: 17.5ms)

@beyondalbert
Copy link

Same problem. Is there some place I can config the upload image size limit?

@sylvainfaivre
Copy link

Hi, in case anyone is still following this issue, I found the fix on a StackOverflow post :

https://stackoverflow.com/questions/76716910/cant-upload-image-on-redmine-5-using-ckeditor

Edit redmine_ckeditor/assets/javascripts/browser.js, line 318 :
from : handlerClass = 'UploadHandlerXhr';
to : handlerClass = 'UploadHandlerForm';

This fixed the bug for me, using Redmine 5.1.0 with CKEditor plugin fork from https://www.redmine-x.com/redminex-ck-editor-free

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants