rejetto forum

Software => HFS ~ HTTP File Server => Bug reports => Topic started by: raybob on March 19, 2012, 04:40:56 AM

Title: User Notes Whitespace
Post by: raybob on March 19, 2012, 04:40:56 AM
Constant use of {.set account|n|notes key=a=b.} seems to fill up the user notes with huge amounts of whitespace.

Can someone else see if this happens to them also?
Title: Re: User Notes Whitespace
Post by: Roessi on March 19, 2012, 12:46:24 PM
Yea i checked that and experienced the same problem, for every call a whitespace is added,

You can trim all the existing out by using

Code: [Select]
{.set account|$1|notes={.decodeuri|{.replace|%0A%0D||{.encodeuri|{.trim|{.get account|$1|notes.}.}.}.}.}.}

and to avoid it u have to set the entire notes again, but trimmed
ieither by adding a line after every call or adding an alias and using it instead , like :

Code: [Select]
[special:alias|private]
addnote={.set account|$1|notes key=$2=$3.}{.set account|$1|notes={.trim|{.get account|$1|notes.}.}.}
Title: Re: User Notes Whitespace
Post by: raybob on March 20, 2012, 01:34:13 AM
Very nice!!  That works perfectly for removing whitespace.  I just put it in my sign in and sign out scripts so it's done once in a while for each account and will keep hfs.ini from expanding exponentially.  

I created my own ^notes function which is simpler to use and put your function in there so that my notes are always nice and tidy  ;)
Title: Re: User Notes Whitespace
Post by: rejetto on April 03, 2012, 09:54:46 PM
the bug is clearly in this line
replace(s, val, i, findEOL(s,i));

in file utillib.pas:2740
sadly i cannot compile HFS at the moment, i will just put this in the to-do list.
Title: Re: User Notes Whitespace
Post by: raybob on April 06, 2012, 04:25:32 AM
Glad you figured it out.  Here's the function I'm using:

Code: [Select]
{.set|notes|{:{.if|$3|{:{.set account|$1|notes key=$2=$3.}{.set account|$1|notes={.decodeuri|{.replace|%0A%0D||{.encodeuri|{.trim|{.get account|$1|notes.}.}.}.}.}.}:}.}{.if|{.and|$2|{.not|$3.}|{.not|$4.}.}|{:{.get account|$1|notes key=$2.}:}.}{.if|{.and|$2|{.not|$3.}|$4.}|{:{.set account|$1|notes={.decodeuri|{.replace|%0A%0D||{.encodeuri|{.trim|{.replace|$2={.^notes|$1|$2.}||{.get account|$1|notes.}.}.}.}.}.}.}:}.}:}.}

{.^notes|username|key.}            expands to its value
{.^notes|username|key|value.}    writes a new value
{.^notes|username|key||true.}    erases the key
Title: Re: User Notes Whitespace
Post by: rejetto on June 30, 2012, 12:25:30 AM
fixed in #280