You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ponymail.apache.org by sebb <se...@gmail.com> on 2016/09/13 09:20:07 UTC

Re: [1/2] incubator-ponymail git commit: padding

On 8 September 2016 at 07:08,  <hu...@apache.org> wrote:
> Repository: incubator-ponymail
> Updated Branches:
>   refs/heads/coffee-and-cake ae791c1a6 -> 20031f532
>
>
> padding
>
>
> Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
> Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/5baa9534
> Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/5baa9534
> Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/5baa9534
>
> Branch: refs/heads/coffee-and-cake
> Commit: 5baa9534da5a055adb7d311bd4a29205eb7f00de
> Parents: ae791c1
> Author: Daniel Gruno <hu...@apache.org>
> Authored: Thu Sep 8 08:07:35 2016 +0200
> Committer: Daniel Gruno <hu...@apache.org>
> Committed: Thu Sep 8 08:07:35 2016 +0200
>
> ----------------------------------------------------------------------
>  site/js/coffee/misc.coffee | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/5baa9534/site/js/coffee/misc.coffee
> ----------------------------------------------------------------------
> diff --git a/site/js/coffee/misc.coffee b/site/js/coffee/misc.coffee
> index 2ac684c..8d94389 100644
> --- a/site/js/coffee/misc.coffee
> +++ b/site/js/coffee/misc.coffee
> @@ -105,7 +105,7 @@ shortenURL = (mid) ->
>              num = parseInt(a, 16)
>              res = num.toString(36)
>              while res.length < 7
> -                res = '0' + res
> +                res = '-' + res
>              out += res
>          return "PZ" + out
>
> @@ -115,7 +115,7 @@ unshortenURL = (mid) ->
>      if mid.substr(0,2) == 'PZ'
>          out = ""
>          for i in [0..shortBits-1]
> -            num = parseInt(mid.substr(2+(i*7), 7), 36)
> +            num = parseInt(mid.substr(2+(i*7), 7).replace('-', ''), 36)

That invocation of replace only fixes the first '-' in an encoded chunk.

The result is corruption of any mids which have leading zeros in a chunk

>              res = num.toString(16)
>              while res.length < 8
>                  res = '0' + res
>

Re: [1/2] incubator-ponymail git commit: padding

Posted by Daniel Gruno <hu...@apache.org>.
On 09/13/2016 11:20 AM, sebb wrote:
> On 8 September 2016 at 07:08,  <hu...@apache.org> wrote:
>> Repository: incubator-ponymail
>> Updated Branches:
>>   refs/heads/coffee-and-cake ae791c1a6 -> 20031f532
>>
>>
>> padding
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/5baa9534
>> Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/5baa9534
>> Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/5baa9534
>>
>> Branch: refs/heads/coffee-and-cake
>> Commit: 5baa9534da5a055adb7d311bd4a29205eb7f00de
>> Parents: ae791c1
>> Author: Daniel Gruno <hu...@apache.org>
>> Authored: Thu Sep 8 08:07:35 2016 +0200
>> Committer: Daniel Gruno <hu...@apache.org>
>> Committed: Thu Sep 8 08:07:35 2016 +0200
>>
>> ----------------------------------------------------------------------
>>  site/js/coffee/misc.coffee | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/5baa9534/site/js/coffee/misc.coffee
>> ----------------------------------------------------------------------
>> diff --git a/site/js/coffee/misc.coffee b/site/js/coffee/misc.coffee
>> index 2ac684c..8d94389 100644
>> --- a/site/js/coffee/misc.coffee
>> +++ b/site/js/coffee/misc.coffee
>> @@ -105,7 +105,7 @@ shortenURL = (mid) ->
>>              num = parseInt(a, 16)
>>              res = num.toString(36)
>>              while res.length < 7
>> -                res = '0' + res
>> +                res = '-' + res
>>              out += res
>>          return "PZ" + out
>>
>> @@ -115,7 +115,7 @@ unshortenURL = (mid) ->
>>      if mid.substr(0,2) == 'PZ'
>>          out = ""
>>          for i in [0..shortBits-1]
>> -            num = parseInt(mid.substr(2+(i*7), 7), 36)
>> +            num = parseInt(mid.substr(2+(i*7), 7).replace('-', ''), 36)
> 
> That invocation of replace only fixes the first '-' in an encoded chunk.
> 
> The result is corruption of any mids which have leading zeros in a chunk

Yeah, I just spotted that myself, it's in the commit queue :)

With regards,
Daniel.

> 
>>              res = num.toString(16)
>>              while res.length < 8
>>                  res = '0' + res
>>