[ 
https://issues.apache.org/jira/browse/JSPWIKI-1318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18140424#comment-18140424
 ] 

ASF subversion and git services commented on JSPWIKI-1318:
----------------------------------------------------------

Commit ec7c7a8d737e8121a1e49f4ce0260968ffb21351 in jspwiki's branch 
refs/heads/master from Arturo Bernal
[ https://gitbox.apache.org/repos/asf?p=jspwiki.git;h=ec7c7a8d7 ]

JSPWIKI-1318 Keep the plus sign of a value when the cookies are read

The function that reads a cookie decoded the value and then replaced every plus 
sign with a
blank. The value is written with encodeURIComponent, which writes a plus sign 
as %2B, so
the plus sign was lost when the preferences were read, and the next save stored 
the blank:
a time zone such as GMT+5 became GMT 5 and the selector showed the first option.

The plus signs of the raw value are now replaced before it is decoded. A blank 
written by
Java, as a plus sign, is still read as a blank, and an encoded plus sign stays 
a plus sign.


> 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