yandod / candycane

a port of Redmine to CakePHP from Ruby on Rails
http://my.candycane.jp
510 stars 127 forks source link

Quotes in <code> tags are replaces by curly quotes, breaking compatibility with SQL codes. #272

Open fabianofa opened 8 years ago

fabianofa commented 8 years ago

If a user updates a issue using <code> (some SQL with quotes) </code>, simple quotes will be replaced with curly quotes which if directly pasted to a Database Manager like MySQL Workbench will alert erros for bad syntax.

screenshot_1 screenshot_2

yandod commented 8 years ago

@fabianofa could you give an example comment which break SQL?

fabianofa commented 8 years ago

The example is shown on the first image. The second screenshot is the text written inside the <textarea> input when an user click to update an issue.

Transcribing the images:

The SQL written while editing:

CREATE TABLE payment_methods (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '',
  description VARCHAR(45) NOT NULL COMMENT '',
  status TINYINT(1) NULL DEFAULT 1 COMMENT '',
  PRIMARY KEY (id)  COMMENT ''
);

The SQL how is shown after clicking on save:

CREATE TABLE payment_methods ( id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT ‘’, description VARCHAR(45) NOT NULL COMMENT ‘’, status TINYINT(1) NULL DEFAULT 1 COMMENT ‘’, PRIMARY KEY (id) COMMENT ‘’ );

Also, may I suggest the syntax highlight lib https://highlightjs.org/ ? It allows users to set a class= attribute in <code> tags, such as sql so the content inside <code class="sql"> would have color highlight.

yandod commented 8 years ago

I now understand what is happening.

copy and paste SQL into some database tool from ticket is not primary concern of candycane. notes of ticket can note detect which text is sql or not.