Problems with Twisted Web & non-standard file names...

Folks, I am in the process of writing, a "gallery" style web server application using twisted.... The main goal is to be able to browse, and access my image library, without having to add the files to a database, etc.... The issue I am having is with the URL processing.... Standard ASCII, and non-extended characters are working fine.... And I've tried using urllib.quote & urllib.quoteplus (along with unquote), to solve this problem.... But an URL with a dash (-) or number sign (#), or non-ASCII (eg 2012.7.1-撮影会- de die in diem) prevents it working... The DASH or number sign will generally produce a 500 internal server error, non-ascii, will allow me to transverse to the directory, but the server fails to properly decode the URL, and none of the images work..... What happens is.... Server side - The Server decodes the request string, and transverse to the directory structure in the URL. For example, http://127.0.0.1:8888/albums/Television/B5/ would transverse into the albums / Television / B5 directory.... And http://127.0.0.1:8888/albums/Television/B5/ADVDEST.JPG?slideshow=1 would show the ADVDEST.JPG that is stored in the directory... The issue I am having is that the POST request string is stopping at a single quote mark... pre - ['albums'] post - ['anime', '(C54) [RPG'] RS /albums/anime/(C54) [RPG /Volumes/DVR Storage/MMAP/gallery/sites ['albums'] POST ['anime', '(C54) [RPG'] ARGS {} The directory name is (c54) [rpg' company (toumi haruka)] wedding bell (ah my goddess) [english][saha]. Any one have any suggestions on how to solve this? As I mentioned URLlib.quote_plus / unquote_plus don't seem to make a difference.... The one idea I had, was to send the web server an index, but that would be a pain, since you would not be able to type in the directory, as a shortcut... You would only be able to transverse via the web GUI.... - Benjamin

On 16 Nov, 02:49 pm, benjamin@schollnick.net wrote:
Folks,
I am in the process of writing, a "gallery" style web server application using twisted....
The main goal is to be able to browse, and access my image library, without having to add the files to a database, etc....
The issue I am having is with the URL processing....
Standard ASCII, and non-extended characters are working fine.... And I've tried using urllib.quote & urllib.quoteplus (along with unquote), to solve this problem....
But an URL with a dash (-) or number sign (#), or non-ASCII (eg 2012.7.1-撮影会- de die in diem) prevents it working...
The DASH or number sign will generally produce a 500 internal server error, non-ascii, will allow me to transverse to the directory, but the server fails to properly decode the URL, and none of the images work.....
Twisted Web should log an exception with a traceback any time it emits a 500 error. Have you checked the logs to see what exception is happening? "#" has special meaning in a URL, and if you are typing it into a browser's location bar, then the browser is intentionally *not* sending it or anything following it. You have to type %23 instead to represent a "#" that is part of the PATH of a URL. A literal "#" signifies the start of the "fragment" portion of the URL. Jean-Paul
What happens is....
Server side -
The Server decodes the request string, and transverse to the directory structure in the URL. For example, http://127.0.0.1:8888/albums/Television/B5/ would transverse into the albums / Television / B5 directory.... And http://127.0.0.1:8888/albums/Television/B5/ADVDEST.JPG?slideshow=1 would show the ADVDEST.JPG that is stored in the directory...
The issue I am having is that the POST request string is stopping at a single quote mark...
pre - ['albums'] post - ['anime', '(C54) [RPG'] RS /albums/anime/(C54) [RPG /Volumes/DVR Storage/MMAP/gallery/sites ['albums'] POST ['anime', '(C54) [RPG'] ARGS {}
The directory name is (c54) [rpg' company (toumi haruka)] wedding bell (ah my goddess) [english][saha].
Any one have any suggestions on how to solve this? As I mentioned URLlib.quote_plus / unquote_plus don't seem to make a difference....
The one idea I had, was to send the web server an index, but that would be a pain, since you would not be able to type in the directory, as a shortcut... You would only be able to transverse via the web GUI....
- Benjamin
participants (2)
-
Benjamin Schollnick
-
exarkun@twistedmatrix.com