[ 
https://issues.apache.org/jira/browse/JSPWIKI-1318?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Arturo Bernal updated JSPWIKI-1318:
-----------------------------------
    Description: 
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 is 
open: https://github.com/apache/jspwiki/pull/564.

  was:
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.


> 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 
> is open: https://github.com/apache/jspwiki/pull/564.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to