Bug 37965

Summary: Fix regression of convert_urls setting in TinyMCE which causes unexpected URL rewriting
Product: Koha Reporter: Lari Taskula <lari.taskula>
Component: ToolsAssignee: Lari Taskula <lari.taskula>
Status: Pushed to main --- QA Contact: David Cook <dcook>
Severity: minor    
Priority: P5 - low CC: dcook
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00
Circulation function:
Bug Depends on: 12032, 22661    
Bug Blocks:    
Attachments: Bug 37965: Restore Bug 12032 - TinyMCE rewrites urls in a very annoying and unexpected way
Bug 37965: Restore Bug 12032 - TinyMCE rewrites urls in a very annoying and unexpected way
Bug 37965: Restore Bug 12032 - TinyMCE rewrites urls in a very annoying and unexpected way
Bug 37965: (QA follow-up) fix WYSIWYG in sysprefs

Comment 1 Lari Taskula 2024-09-19 17:38:22 UTC
Created attachment 171787 [details] [review]
Bug 37965: Restore Bug 12032 - TinyMCE rewrites urls in a very annoying and unexpected way

To test:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12032#c3
Comment 2 Lucas Gass (lukeg) 2024-09-26 19:01:34 UTC
Created attachment 172021 [details] [review]
Bug 37965: Restore Bug 12032 - TinyMCE rewrites urls in a very annoying and unexpected way

To test:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12032#c3

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 David Cook 2024-10-29 22:33:40 UTC
Adding bug 22661 as dependency as Lari mentions that in bug 12032

I'll take a quick look at this one as this can be a super annoying problem.
Comment 4 David Cook 2024-10-29 22:41:11 UTC
Test plan:
1. Go to http://localhost:8081/cgi-bin/koha/tools/additional-contents.pl?
op=add_form&category=news&editmode=wysiwyg
2. In the Content box, type "This is cool" and then make "cool" into a link
to "http://localhost:8081/cool.pl"
3. Note that the URL has been rewritten to just "/cool.pl" when you check
the source code

4. Apply the patch

5. Repeat the same process as you did before applying the patch

6. Note that now the URL has NOT been rewritten and remains
http://localhost:8081/cool.pl
Comment 5 David Cook 2024-10-29 22:47:10 UTC
Created attachment 173695 [details] [review]
Bug 37965: Restore Bug 12032 - TinyMCE rewrites urls in a very annoying and unexpected way

To test:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12032#c3

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Comment 6 David Cook 2024-10-29 22:47:13 UTC
Created attachment 173696 [details] [review]
Bug 37965: (QA follow-up) fix WYSIWYG in sysprefs

Test plan:
1. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?
op=search&searchfield=UseWYSIWYGinSystemPreferences
2. Enable the system preference to show WYSIWYG in HTML system preferences
3. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?
op=search&searchfield=OPACSearchForTitleIn
4. Add a link for "http://localhost:8081/cool.pl"
5. Note in the source code that the URL gets mangled

6. Apply the patch

7. Repeat the above test plan
8. Note that the URL has NOT been mangled and remains
http://localhost:8081/cool.pl
Comment 7 David Cook 2024-10-29 22:55:33 UTC
Thanks for that fix, Lari. 

I've added a follow-up to fix it in the syspref WYSIWYG TinyMCE as well.

--

In theory, it looks like this affects Koha going back to 19.11... 

I'm surprised that we haven't had this come up earlier, but I just confirmed that it's a problem in 23.11.

--

Setting the version to Main, but I reckon this needs backporting as far back as we can...
Comment 8 Katrin Fischer 2024-10-30 06:48:40 UTC
Pushed for 24.11!

Well done everyone, thank you!