[
https://issues.apache.org/jira/browse/JSPWIKI-1318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18135872#comment-18135872
]
Arturo Bernal commented on JSPWIKI-1318:
----------------------------------------
A pull request is open: https://github.com/apache/jspwiki/pull/564. The plus
signs of the raw value are replaced by blanks before the value is decoded, so
an encoded plus sign (%2B) stays a plus sign, and a blank written by Java as a
plus sign is still read as a blank. Only the reader in util/cookies.js changes.
The measurements in the browser are described in the pull request; there is no
automated test.
> User preferences lose a plus sign: a time zone such as GMT+5 is not saved
> -------------------------------------------------------------------------
>
> Key: JSPWIKI-1318
> URL: https://issues.apache.org/jira/browse/JSPWIKI-1318
> Project: JSPWiki
> Issue Type: Bug
> Reporter: Arturo Bernal
> Priority: Major
> Labels: pull-request-available
>
> A time zone with a plus sign cannot be saved in the user preferences.
> Steps: open UserPreferences.jsp, choose the time zone GMT+5 (the list has 16
> zones with a plus sign, all of them to the east of Greenwich), save, and open
> the page again.
> Expected: the time zone is still GMT+5.
> Actual: the selector shows the first option of the list, GMT-12. The cookie
> JSPWikiUserPrefs holds GMT 5, with a blank where the plus sign was. A zone
> with a minus sign, such as GMT-5, is kept.
> Cause: the function that reads cookies, in
> jspwiki-war/src/main/scripts/util/cookies.js, decodes the value and then
> replaces every plus sign with a blank. The value is written with
> encodeURIComponent, which writes a plus sign as %2B, so the plus sign is lost
> when the preferences are read, and the next save stores the blank.
> Found with the current master (3.0.1-SNAPSHOT, Tomcat 10.1, Chrome). Related
> to JSPWIKI-1049, where a time zone was one of the preferences that were not
> kept; the case of that report, GMT-5, is not affected by this. A pull request
> follows.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)