mikitex70 / redmine_drawio

Macro plugin to embed draw.io diagrams into Redmine wiki pages
MIT License
121 stars 51 forks source link

Error with diagram in Wiki page with "+" sign in name. #92

Closed martinbra closed 3 years ago

martinbra commented 3 years ago

Hi @mikitex70 , first of all, thanks for the amazing effort on keeping your plugin updated. It's sad that not many plugins receive this much care.

I'm having a similar problem to #77, but probably due to an path name conflict due to a + sign in the wiki page name.

Steps to reproduce:

  1. Create wiki page with name testing+ or Te+st, or any name with a + sign.
  2. Use macro {{drawio_attach(teste_with_sign.png)}} and save.
  3. Double-click yellow button and draw something
  4. Save
  5. Now diagram shows up in page, but error pop-ups: Make sure WebDAV capabilities of DMSF module is enabled (seems to be 404 in code) STRANGE as I'm not using DMSF module.
  6. Attachment is saved to the server files folder.
  7. After page refresh yellow button appears again.

If I make the same steps for a page without a plus sign on it, there is no issue with the plugin displaying the diagram.

This is my redmine log for the event:

Started GET "/projects/informacoes-redmine/wiki/Te+st" for 192.168.1.1 at 2021-05-07 12:19:52 +0000
Processing by WikiController#show as HTML
  Parameters: {"project_id"=>"informacoes-redmine", "id"=>"Te+st"}
  Current user: admin (id=1)
  Rendering wiki/show.html.erb within layouts/base
  Rendered wiki/_content.html.erb (9.0ms)
  Rendered attachments/_form.html.erb (3.0ms)
  Rendered wiki/_sidebar.html.erb (2.9ms)
  Rendered wiki/show.html.erb within layouts/base (35.7ms)
  Rendered plugins/redmine_more_previews/app/views/hooks/redmine_more_previews/_icon_css.html.erb (0.2ms)
  Rendered plugins/redmine_drawio/app/views/redmine_drawio/_macro_dialog.html.erb (0.9ms)
Completed 200 OK in 124ms (Views: 91.4ms | ActiveRecord: 17.3ms)
Started POST "/uploads.json?filename=teste_with_sign_1.png" for 192.168.1.1 at 2021-05-07 12:20:06 +0000
Processing by AttachmentsController#upload as JSON
  Parameters: {"filename"=>"teste_with_sign_1.png"}
  Current user: admin (id=1)
Saving attachment '/opt/redmine-4.1/files/2021/05/210507122006_teste_with_sign_1.png' (975 bytes)
  Rendering attachments/upload.api.rsb
  Rendered attachments/upload.api.rsb (0.2ms)
Completed 201 Created in 23ms (Views: 1.2ms | ActiveRecord: 8.7ms)
Started GET "/projects/informacoes-redmine/wiki/Te+st/Te+st.json?include=journals" for 192.168.1.1 at 2021-05-07 12:20:06 +0000

ActionController::RoutingError (No route matches [GET] "/projects/informacoes-redmine/wiki/Te+st/Te+st.json"):

I'm using:

Environment:
  Redmine version                4.1.1.stable.20703
  Ruby version                   2.6.6-p146 (2020-03-31) [x86_64-linux]
  Rails version                  5.2.4.2
  Environment                    production
  Database adapter               PostgreSQL
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Subversion                     1.13.0
  Cvs                            1.12.13
  Git                            2.25.1
  Filesystem                     
Redmine plugins:
  redmine_drawio                 1.0.1
  redmine_more_previews          2.0.0

Is there anything else I should be looking at? Images attachments are working as expected.

mikitex70 commented 3 years ago

Hi @martinbra, this bug seems very similar to #91, which is now fixed in the develop branch. The only trouble is that I cannot reproduce the popup showing up with the WebDAV message. I will do more test...

martinbra commented 3 years ago

Thanks. Could you reproduce the failure to save the diagram? (After F5 the diagram is gone from the page, but is listed in the redmine files folder). If you want me to test the branch before releasing I'm opened to it.

martinbra commented 3 years ago

And going further down the line... how can we be sure that no other symbol can cause this issue? (I haven't tested any beyond +)?

mikitex70 commented 3 years ago

Hi @martinbra , I was able to reproduce your issue and to fix it. It's now released in the v1.0.2 release. The issue was caused by the wrong encoding of the + sign in the url. The fix should resolve issues with other characters too. Thanks for reporting it.

martinbra commented 3 years ago

Working like a charm! Thanks.