Bug 6900 - Submissions with tags in titles truncated to '...' in submission lists
Submissions with tags in titles truncated to '...' in submission lists
Status: RESOLVED FIXED
Product: OJS
Classification: Unclassified
Component: General
2.3.8
All All
: P3 normal
Assigned To: Michael Felczak
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-26 04:08 PDT by Matthew Crider
Modified: 2012-05-01 14:19 PDT (History)
5 users (show)

See Also:
Version Reported In:
Also Affects: OCS 2.3.5


Attachments
Patch against OJS 2.3.7 (should also work with 2.3.6, 2.3.5, etc.) (23.22 KB, patch)
2012-04-27 10:01 PDT, Michael Felczak
Details | Diff
Patch against OCS 2.3.5 (should also work with 2.3.4, 2.3.3, etc.) (19.93 KB, patch)
2012-04-27 11:07 PDT, Michael Felczak
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Crider 2011-09-26 04:08:48 PDT
Submissions with e.g. italics tags in the first 40 characters are showing up as '...' in the submission lists (e.g. editor's 'submissions in editing' page).
Comment 1 Charles Parker 2012-01-13 09:47:04 PST
Our site is also experiencing this issue. It occurs in all lists under the editor interface, and is the result of using strip_unsafe_tags in combination with truncate. Basically, this allows 'safe' tags (e.g., italics) through but in many cases cuts off one or more closing tags, resulting in non-well-formed HTML.

For instance, in templates/editor/issues/issueToc.tpl:

Original line:

<td class="drag">{if !$isLayoutEditor}<a href="{url op="submission" path=$articleId}" class="action">{/if}{$article->getLocalizedTitle()|strip_unsafe_html|truncate:60:"..."}{if !$isLayoutEditor}</a>{/if}</td>

(the above produces "..." in many cases).


Workaround 1: Change strip_unsafe_html to strip_tags (removes all tags, making the text safe for truncate).

<td class="drag">{if !$isLayoutEditor}<a href="{url op="submission" path=$articleId}" class="action">{/if}{$article->getLocalizedTitle()|strip_tags|truncate:60:"..."}{if !$isLayoutEditor}</a>{/if}</td>

(the above produces "High quality draft genome sequence of Segniliparus...", where 'Segniliparus' is the first word of an italicized phrase).


Workaround 2: Remove '|truncate:60:"..."' (prevents stranded opening tags).

<td class="drag">{if !$isLayoutEditor}<a href="{url op="submission" path=$articleId}" class="action">{/if}{$article->getLocalizedTitle()|strip_unsafe_html}{if !$isLayoutEditor}</a>{/if}</td>

(the above produces "High quality draft genome sequence of <i>Segniliparus rugosus</i> CDC 945T= (ATCC BAA-974T)", the complete title with starting and closing tags).

I prefer workaround 1.

Based on a quick search of the code, it looks like this may be an issue in at least 24 places in the code:

grep -r strip_ ./OJS/templates/ | grep truncate | wc -l
      24

Also refer to the following forum thread:
http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=7872
Comment 2 Charles Parker 2012-01-13 10:06:29 PST
This appears to be the complete list of affected source files:

# grep -r strip_unsafe OJS | grep truncate | grep -v cache | cut -d':' -f1

OJS/plugins/generic/booksForReview/templates/editor/submissions.tpl
OJS/plugins/generic/staticPages/settingsForm.tpl
OJS/templates/author/active.tpl
OJS/templates/author/active.tpl (NOTE: 2 cases in this file)
OJS/templates/author/completed.tpl
OJS/templates/comment/comments.tpl
OJS/templates/copyeditor/active.tpl
OJS/templates/copyeditor/completed.tpl
OJS/templates/editor/index.tpl
OJS/templates/editor/issues/issueToc.tpl
OJS/templates/editor/submissionsArchives.tpl
OJS/templates/editor/submissionsInEditing.tpl
OJS/templates/editor/submissionsInReview.tpl
OJS/templates/editor/submissionsUnassigned.tpl
OJS/templates/layoutEditor/active.tpl
OJS/templates/layoutEditor/completed.tpl
OJS/templates/proofreader/active.tpl
OJS/templates/proofreader/completed.tpl
OJS/templates/reviewer/active.tpl
OJS/templates/reviewer/completed.tpl
OJS/templates/rt/rt.tpl
OJS/templates/sectionEditor/submissionEventLog.tpl
OJS/templates/sectionEditor/submissionHistory.tpl
OJS/templates/sectionEditor/submissionsArchives.tpl
OJS/templates/sectionEditor/submissionsInEditing.tpl
OJS/templates/sectionEditor/submissionsInReview.tpl
Comment 3 Charles Parker 2012-01-13 11:05:40 PST
Additionally, it wouldn't hurt to check all other uses of truncate to ensure there are not additional forms of this error.

grep -r "truncate:" . | grep -v strip_ | wc -l
     50

strip_tags should be used in any of the above cases where HTML is potentially contained in a variable.
Comment 4 barbara.hui 2012-02-01 14:12:02 PST
We're experiencing this problem at the California Digital Library as well. This poses a significant problem for many of our journals who have many articles with HTML mark-up in them.
Comment 5 Michael Felczak 2012-04-27 09:30:16 PDT
Thank you Chuck for tracking this down and providing the additional shortlist of affected files.

Barbara and Chuck, if there are no additional comments from your end, I'll be updating the identified affected files with workaround #1, replacing strip_unsafe_html with strip_tags.
Comment 6 Michael Felczak 2012-04-27 10:01:34 PDT
Created attachment 3750 [details]
Patch against OJS 2.3.7 (should also work with 2.3.6, 2.3.5, etc.)
Comment 7 Michael Felczak 2012-04-27 10:50:08 PDT
The following files are affected in OCS stable:

plugins/generic/staticPages/settingsForm.tpl
templates/author/active.tpl
templates/author/active.tpl
templates/author/completed.tpl
templates/comment/comments.tpl
templates/director/schedulingQueue.tpl
templates/director/submissionsAccepted.tpl
templates/director/submissionsArchives.tpl
templates/director/submissionsInReview.tpl
templates/director/submissionsUnassigned.tpl
templates/manager/conferenceEventLog.tpl
templates/manager/conferenceEventLog.tpl
templates/manager/reviewForms/reviewFormElements.tpl
templates/reviewer/active.tpl
templates/reviewer/completed.tpl
templates/rt/rt.tpl
templates/trackDirector/submissionEventLog.tpl
templates/trackDirector/submissionEventLog.tpl
templates/trackDirector/submissionEventLogEntry.tpl
templates/trackDirector/submissionHistory.tpl
templates/trackDirector/submissionHistory.tpl
templates/trackDirector/submissionsAccepted.tpl
templates/trackDirector/submissionsArchives.tpl
templates/trackDirector/submissionsInReview.tpl
Comment 8 Michael Felczak 2012-04-27 11:07:48 PDT
Created attachment 3751 [details]
Patch against OCS 2.3.5 (should also work with 2.3.4, 2.3.3, etc.)
Comment 9 Michael Felczak 2012-04-27 11:42:29 PDT
Committed to OJS and OCS stable.
Comment 10 Michael Felczak 2012-04-27 11:45:03 PDT
Submissions with tags in titles truncated to '...' in submission lists
https://github.com/pkp/ocs/commit/a92b7dcb13c5d86de3dc66d1bd4152f28f4c3978
Comment 11 Michael Felczak 2012-04-27 12:03:00 PDT
Committed to OJS and OCS master.
Comment 12 Michael Felczak 2012-04-27 12:03:11 PDT
Fixed.
Comment 13 Michael Felczak 2012-04-27 12:05:02 PDT
Submissions with tags in titles truncated to '...' in submission lists
https://github.com/pkp/ojs/commit/6ced85ef97f704cfdd1323f0f2c662ebd84463b3
Comment 14 Michael Felczak 2012-04-27 12:05:02 PDT
Submissions with tags in titles truncated to '...' in submission lists
https://github.com/pkp/ocs/commit/4dc63b922355c16674d272ceb27540c31e3e2fe5
Comment 15 Alec Smecher 2012-04-30 12:54:23 PDT
Michael, this appears to affect the reading tools header where OTOH I'm not sure it should -- see the patch to rt.tpl. Also in templates/sectionEditor/submissionEventLog.tpl, templates/sectionEditor/submissionHistory.tpl.
Comment 16 Michael Felczak 2012-05-01 13:00:42 PDT
Alec, are you suggesting that we simply remove the truncate in these cases (i.e. workaround #2)? That may be problematic for long article titles and/or log entries ...
Comment 17 Alec Smecher 2012-05-01 14:19:42 PDT
Sorry, I read too fast -- you're right.