Bug 25862 - TinyMCE editor mangles local url links (relative_urls is true) in tools/koha-new.pl
Summary: TinyMCE editor mangles local url links (relative_urls is true) in tools/koh...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P3 normal (vote)
Assignee: Didier Gautheron
QA Contact: Testopia
URL:
Keywords:
Depends on: 22661
Blocks:
  Show dependency treegraph
 
Reported: 2020-06-24 08:36 UTC by Didier Gautheron
Modified: 2021-06-14 21:31 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.03, 19.11.09


Attachments
Bug 25862: TinyMCE editor mangles local url links in tools/koha-new.pl (2.80 KB, patch)
2020-06-24 14:09 UTC, Didier Gautheron
Details | Diff | Splinter Review
Bug 25862: TinyMCE editor mangles local url links in tools/koha-new.pl (2.87 KB, patch)
2020-06-24 14:14 UTC, Didier Gautheron
Details | Diff | Splinter Review
Bug 25862: TinyMCE editor mangles local url links in tools/koha-new.pl (2.92 KB, patch)
2020-07-13 22:34 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 25862: TinyMCE editor mangles local url links in tools/koha-new.pl (2.98 KB, patch)
2020-07-15 06:17 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 25862: Prevent TinyMCE to mangles local url links (2.94 KB, patch)
2020-07-20 11:11 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Didier Gautheron 2020-06-24 08:36:45 UTC
I don't know if it's an oversight but Bug https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22661 removed relative_urls : false

and now it's impossible to enter a link with a local URL, like a report.

cf.
https://www.tiny.cloud/docs/configure/url-handling/#document_base_url
Comment 1 Owen Leonard 2020-06-24 10:55:54 UTC
How does this bug manifest? I did a quick test to add a relative url to IntranetMainUserBlock and it seemed to work for me.
Comment 2 Didier Gautheron 2020-06-24 11:16:23 UTC
1 create a report 1 if it doesn't exist
2 open /cgi-bin/koha/tools/koha-news.pl
3 create a news
4 add a HTML link with Insert/Edit link tinyMCE dialog box to /cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Run%20this%20report "report 1"
5 save
6 on the main page "report 1" link returns a 404 error

TinyMCE has replaced /cgi-bin/koha/reports.... with
../reports/guided_reports.pl?reports=1&phase=Run%20this%20report

document_base_url isn't set and
'This option specifies the base URL for all relative URLs in the document. The default value is the directory of the current document. If a value is provided, it must specify a directory (not a document) and must end with a /.'
Comment 3 Owen Leonard 2020-06-24 12:41:00 UTC
Ah, sorry, you're right. I see it now too.
Comment 4 Didier Gautheron 2020-06-24 14:09:51 UTC
Created attachment 106250 [details] [review]
Bug 25862:  TinyMCE editor mangles local url links in tools/koha-new.pl

To test:
1 create a report 1 if it doesn't exist
2 open /cgi-bin/koha/tools/koha-news.pl
3 create a news
4 add a HTML link with Insert/Edit link tinyMCE dialog box to
  /cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Run%20this%20report "report 1"
5 save
6 on the main page "report 1" link returns a 404 error

Apply patch
7 Modify news' URL
8 It works
Comment 5 Didier Gautheron 2020-06-24 14:14:30 UTC
Created attachment 106251 [details] [review]
Bug 25862:  TinyMCE editor mangles local url links in tools/koha-new.pl

To test:
1 create a report 1 if it doesn't exist
2 open /cgi-bin/koha/tools/koha-news.pl
3 create a news
4 add a HTML link with Insert/Edit link tinyMCE dialog box to
  /cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Run%20this%20report "report 1"
5 save
6 on the main page "report 1" link returns a 404 error

Apply patch
7 Modify news' URL
8 Test it works in: tools/koha-new.pl admin/branches.pl and admin/preferences.pl
Comment 6 Lucas Gass 2020-07-13 22:34:52 UTC
Created attachment 106856 [details] [review]
Bug 25862: TinyMCE editor mangles local url links in tools/koha-new.pl

To test:
1 create a report 1 if it doesn't exist
2 open /cgi-bin/koha/tools/koha-news.pl
3 create a news
4 add a HTML link with Insert/Edit link tinyMCE dialog box to
  /cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Run%20this%20report "report 1"
5 save
6 on the main page "report 1" link returns a 404 error

Apply patch
7 Modify news' URL
8 Test it works in: tools/koha-new.pl admin/branches.pl and admin/preferences.pl

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 7 Katrin Fischer 2020-07-15 06:17:24 UTC
Created attachment 106893 [details] [review]
Bug 25862: TinyMCE editor mangles local url links in tools/koha-new.pl

To test:
1 create a report 1 if it doesn't exist
2 open /cgi-bin/koha/tools/koha-news.pl
3 create a news
4 add a HTML link with Insert/Edit link tinyMCE dialog box to
  /cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Run%20this%20report "report 1"
5 save
6 on the main page "report 1" link returns a 404 error

Apply patch
7 Modify news' URL
8 Test it works in: tools/koha-new.pl admin/branches.pl and admin/preferences.pl

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Jonathan Druart 2020-07-20 11:11:30 UTC
Created attachment 107085 [details] [review]
Bug 25862: Prevent TinyMCE to mangles local url links

To test:
1 create a report 1 if it doesn't exist
2 open /cgi-bin/koha/tools/koha-news.pl
3 create a news
4 add a HTML link with Insert/Edit link tinyMCE dialog box to
  /cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Run%20this%20report "report 1"
5 save
6 on the main page "report 1" link returns a 404 error

Apply patch
7 Modify news' URL
8 Test it works in: tools/koha-new.pl admin/branches.pl and admin/preferences.pl

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Jonathan Druart 2020-07-20 11:12:54 UTC
Didier, make sure you write correct commit titles. Usually copy/paste of the bug report title is not a good idea for bugfixes.
See https://wiki.koha-community.org/wiki/Commit_messages#Examples
Comment 10 Jonathan Druart 2020-07-20 12:08:08 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 11 Lucas Gass 2020-07-22 22:48:48 UTC
To me this bug is not minor as it has some serious implications with more HTML system prefs finding their way into the News feature, which is a good thing!  

That is also why I will also shamelessly plug Bug 22660 here.

If we could use TinyMCE or CodeMirror in the news cool I'd be more comfortable. :) 

Thanks Didier!
Comment 12 David Cook 2020-07-23 02:21:58 UTC
(In reply to Lucas Gass from comment #11)
> To me this bug is not minor as it has some serious implications with more
> HTML system prefs finding their way into the News feature, which is a good
> thing!  

That's a good point. I actually was bitten recently because post-upgrade the existing HTML got mangled after they did an update. I worked around it, but I imagine many people could have been bitten by this and not known how to work around it.
Comment 13 Lucas Gass 2020-07-24 23:02:17 UTC
backported to 20.05.x for 20.05.03
Comment 14 Aleisha Amohia 2020-08-03 22:34:53 UTC
backported to 19.11.x for 19.11.09
Comment 15 Victor Grousset/tuxayo 2020-09-18 20:00:12 UTC
Not backported to oldoldstable (19.05.x). Feel free to ask if it's needed.