klmr92 / uguu

Automatically exported from code.google.com/p/uguu
Other
0 stars 1 forks source link

[vfs] urlencode paths for links and htmlencode filenames before showing them #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It is a good practice to urlencode strings before giving them as links.
Since we use templates for html rendering urlencoding probably should be
done by postgres.
And we need to htmlencode file names too.

Original issue reported on code.google.com by ruslan.savchenko on 8 Jan 2010 at 10:32

GoogleCodeExporter commented 9 years ago
Usually, filenames couldn't include characters like '>', '<', '"' etc, but not 
'&'.
So, htmlencode probably could be replaced with string::replace("&", "&"). Also,
we use utf-8, so encoding some out-of-basic-ascii characters (like &Acute;) 
does not
have to be performed.

Does django's templates support some basic text functions?

Original comment by radist...@gmail.com on 9 Jan 2010 at 10:24

GoogleCodeExporter commented 9 years ago
Revision 9f647ee483 fixes (probably) this issue for links. Plain text is 
htmlencoded
by default.

Close

Original comment by ruslan.savchenko on 8 Feb 2010 at 11:50

GoogleCodeExporter commented 9 years ago
http://blogs.msdn.com/ie/archive/2006/12/06/file-uris-in-windows.aspx

issue reopened

Original comment by ruslan.savchenko on 28 Mar 2010 at 10:08

GoogleCodeExporter commented 9 years ago
Now filter iriencode  is used for search results and urlencode for vfs.

For example directory shown as tp%3a%2f%2fcygwin.dp.ua%2fpub%2fmirrors%2f in 
vfs has
vfs link 

href="ftp%253a%252f%252fcygwin.dp.ua%252fpub%252fmirrors%252f/?p=186&s=17"

and search link
href="/vfs/ftp/..../0/Dist/Common/Cygwin/ftp%3a%2f%2fcygwin.dp.ua%2fpub%2fmirror
s%2f/release/?p=191&s=17&o=2"

IIRC i've used iriencode for search links because our own get parameters are 
embedded
into a link.

Original comment by ruslan.savchenko on 18 Apr 2010 at 9:46

GoogleCodeExporter commented 9 years ago
Forgot to mention: vfs link works fine while search one doesn't.

Original comment by ruslan.savchenko on 18 Apr 2010 at 9:47

GoogleCodeExporter commented 9 years ago
but "contents of" links is also bad for this directory

Original comment by ruslan.savchenko on 18 Apr 2010 at 1:25