taqueci / redmine_wysiwyg_editor

Redmine WYSIWYG Editor plugin
GNU General Public License v2.0
114 stars 27 forks source link

plugin shows blank page when the page title contains a single quote #110

Open garz75 opened 3 years ago

garz75 commented 3 years ago

It looks like the plugin does not like when the redmine wiki page title contains a single quote " ' " (ascii code DEC 39, HEX 27)

Steps to reproduce :

  1. Switch to textile editor in an existing page.
  2. Create a page named Let's rock, and add some rich content (h1, etc.)
  3. Swith to Visual editor
  4. A blank page is displayed, instead of the html page content inserted at step 2

Workaround : rename page to "Lets rock"

Thank you for the good job BTW. The plugin savez me a lot of time when editing tables...

taqueci commented 3 years ago

Hi @garz75

I can't reproduce the issue. Could you please tell me your environment?

Note I had confirmed in the environment:

Environment:
  Redmine version                4.1.1.stable
  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.10.4
  Mercurial                      4.8.2
  Bazaar                         2.8.0
  Git                            2.20.1
  Filesystem                     
  Github                         2.20.1
Redmine plugins:
  redmine_wysiwyg_editor         0.18.0
garz75 commented 3 years ago

Sorry I do not know how to generate your "version report". Here is the info I could gather:

redmine@central:~/redmine_internal$ rake about
About your application's environment
Rails version             4.2.11.1
Ruby version              2.4.10-p364 (x86_64-linux)
RubyGems version          3.0.8
Rack version              1.6.13
Middleware                Rack::Sendfile, Rack::ContentLength, ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x000055c3ede5ed98>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, ActionDispatch::XmlParamsParser, Rack::Head, Rack::ConditionalGet, Rack::ETag, RequestStore::Middleware, OpenIdAuthentication
Application root          /home/redmine/redmine_internal
Environment               production
Database adapter          postgresql
Database schema version   20170419144536
redmine@central:~/redmine_internal$ rake middleware
use Rack::Sendfile
use Rack::ContentLength
use ActionDispatch::Static
use Rack::Lock
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x000055b04c026cf8>
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use ActionDispatch::RemoteIp
use ActionDispatch::Callbacks
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use ActionDispatch::XmlParamsParser
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
use RequestStore::Middleware
use OpenIdAuthentication
run RedmineApp::Application.routes
redmine@central:~/redmine_internal$ git status
HEAD detached at 3.4.13

|Redmine Custom CSS plugin Allows to customize Redmine's CSS https://github.com/martin-denizet/redmine_custom_css | Martin DENIZET | 0.1.7 | |Redmine Wiki Extensions plugin This is a Wiki Extensions plugin for Redmine http://www.r-labs.org/projects/r-labs/wiki/Wiki_Extensions_en | Haruyuki Iida | 0.8.1 |   | Redmine Wiki Notes plugin Allows adding different kinds of notes into a wiki page http://www.github.com/dseifert/redmine_wiki_notes | Daniel Seifert | 0.0.2 |   | Redmine WYSIWYG Editor plugin Redmine WYSIWYG text editorhttps://github.com/taqueci/redmine_wysiwyg_editor | Takeshi Nakamura | 0.15.0|

Looking at the JS console when opening the offending page, I spot a syntax error at the bottom of the main page :

    <script>
//<![CDATA[
setWikiAutoPreview('/projects/rr_fft/wiki/Let's_rock/preview');
//]]>
</script>

as well as other errors in the plugin code, related to the page name (extra / in the url : Let/'s_rock/review):

DevTools failed to load SourceMap: Could not load content for https://SERVERREMOVED/plugin_assets/redmine_wysiwyg_editor/javascripts/tinymce/skins/lightgray/skin.min.css.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
jquery-1.11.1-ui-1.11.0-ujs-3.1.4.js?1555602754:4 POST https://SERVERREMOVED/projects/rr_fft/wiki/Let/'s_rock/preview 404 (Not Found)
send @ jquery-1.11.1-ui-1.11.0-ujs-3.1.4.js?1555602754:4
ajax @ jquery-1.11.1-ui-1.11.0-ujs-3.1.4.js?1555602754:4
RedmineWysiwygEditor._setVisualContent @ redmine_wysiwyg_editor.js?1582646843:705
RedmineWysiwygEditor._changeMode @ redmine_wysiwyg_editor.js?1582646843:200
callback @ redmine_wysiwyg_editor.js?1582646843:319
execCallback @ tinymce.min.js?1582646843:2
rx @ tinymce.min.js?1582646843:2