Thread: [openupload-devel] Different URLs ?
Status: Beta
Brought to you by:
tsdogs
|
From: <nik...@xe...> - 2010-10-21 17:12:07
|
Hi, when using OpenUpload, we ran into the following problem: - A user generates a Download-Link, and sends it by mail (Thunderbird client) to a Mac user. The Mac user gets: https://www.exampleserver.net/openupload/?a=d&i=r7t8DuGPOv instead of https://www.exampleserver.net/openupload/?a=d&i=r7t8DuGPOv So the ampersand is escaped, which makes the link unusable. Of course one could try to find out why this happens and what workaround can be applied on the Thunderbird or Mac side. But I think it would be safer to create safer URLs to begin with, for example https://www.exampleserver.net/openupload/d/r7t8DuGPOv with no special characters excaept the slash. This could be done fairly easy by using Apache rewrite module, so that Apache would rewrite https://www.exampleserver.net/openupload/d/r7t8DuGPOv back to https://www.exampleserver.net/openupload/?a=d&i=r7t8DuGPOv upon calling the URL. And of course, the slash URL would also be displayed in the Interface and sent by mail. This shouldn't be too hard, using the Apache rewrite module. Of course this requires access to the rewrite module (and to Apache). Did anyone already do this? Did I maybe miss an option that already delivers this? If not, I would probably do this and post the result. Or am I missing something that makes my idea look undesirable or unnecessary? Greetings Harald |
|
From: Alessandro B. <ts...@br...> - 2010-10-21 17:33:15
|
Il 21/10/2010 18:56, nik...@xe... ha scritto: > > Hi, > > when using OpenUpload, we ran into the following problem: > > - A user generates a Download-Link, and sends it by mail (Thunderbird client) > to a Mac user. > The Mac user gets: > > https://www.exampleserver.net/openupload/?a=d&i=r7t8DuGPOv > > instead of > > > https://www.exampleserver.net/openupload/?a=d&i=r7t8DuGPOv > > So the ampersand is escaped, which makes the link unusable. > > Of course one could try to find out why this happens and what workaround > can be applied on the Thunderbird or Mac side. > But I think it would be safer to create safer URLs to begin with, for > example > > https://www.exampleserver.net/openupload/d/r7t8DuGPOv > > with no special characters excaept the slash. > This could be done fairly easy by using Apache rewrite module, so that > Apache would rewrite > > https://www.exampleserver.net/openupload/d/r7t8DuGPOv > back to > https://www.exampleserver.net/openupload/?a=d&i=r7t8DuGPOv > > upon calling the URL. And of course, the slash URL would also be displayed > in the Interface and sent by mail. > > This shouldn't be too hard, using the Apache rewrite module. Of course this requires access to the rewrite module (and to Apache). > Did anyone already do this? Did I maybe miss an option that already > delivers this? > > If not, I would probably do this and post the result. > > Or am I missing something that makes my idea look undesirable or unnecessary? > Hi, Sure it can be done. mod_rewrite support was one of the features scheduled for future releases. Why is that unusable? By specification the first notation (the one used by openupload) is the wrong one in an html document (browsers fix that but it's wrong). in urls the ampersand should be noted as & if it's html but not the text version. Probably you have some html to text conversion, and that's where the problem is. I do agree with you that having a mod_rewrite structure should be the best. Also a notation like http://www.exampleserver.net/openupload/index.php/d/r7t8DuGPOv could work, without needing mod_rewrite access, but urls need to be fixed and handled in the application for that to happen. mod_rewrite can be tweaked to support that notation already so any feedback is appreciated. Alessandro |
|
From: Harald N. <nik...@xe...> - 2010-10-21 21:23:42
|
Hi again, > Why is that unusable? By specification the first notation (the one used > by openupload) is the wrong one in an html document (browsers fix that > but it's wrong). > > in urls the ampersand should be noted as & if it's html but not the > text version. Probably you have some html to text conversion, and that's > where the problem is. Yes, you are right. But the problem is this could happen with some other faulty clients, too. So I guess it is better to get rid of the ampersands in the URL altogether. > I do agree with you that having a mod_rewrite structure should be the > best. Also a notation like > http://www.exampleserver.net/openupload/index.php/d/r7t8DuGPOv > could work, without needing mod_rewrite access, but urls need to be > fixed and handled in the application for that to happen. Oh, right. So what would be easier? I guess not using mod_rewrite means more rewriting in the application, does it? Cheers Harald > mod_rewrite can be tweaked to support that notation already so any > feedback is appreciated. > > Alessandro > > ------------------------------------------------------------------------------ > Nokia and AT&T present the 2010 Calling All Innovators-North America contest > Create new apps & games for the Nokia N8 for consumers in U.S. and Canada > $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store > http://p.sf.net/sfu/nokia-dev2dev > _______________________________________________ > Openupload-devel mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openupload-devel > |
|
From: Alessandro B. <ts...@br...> - 2010-10-22 08:08:41
|
Hi Harald. Il 21/10/2010 23:23, Harald Nikolaus ha scritto: > Hi again, > ... > > Oh, right. So what would be easier? I guess not using mod_rewrite means > more rewriting in the application, does it? > Yes, this needs some coding. The simplest would be to have a redirect, to the page with the & version So intercept the actions you need and redirect according, but haven't looked deep enough yet. I guess that right now best way is go the mod_rewrite rule (and change the links returned by the file.inc.php to the user Alessandro |
|
From: Harald N. <nik...@xe...> - 2010-10-25 21:31:55
|
Hi all, so here are the lines necessary to create a safer URL. containing just letters, digits and slashes: In lib/modules/default/files.inc.php, look for function setupLinks on line 260 Replace $finfo[0]['downloadlink']= app()->config['WWW_SERVER'].app()->config['WWW_ROOT'].'/?'.$a.'=d&'.$i.'='.$finfo[0]['id']; $finfo[0]['removelink']=app()->config['WWW_SERVER'].app()->config['WWW_ROOT']. '/?'.$a.'=r&'.$i.'='.$finfo[0]['id'].'&'.$r.'='.$finfo[0]['remove']; with: $finfo[0]['downloadlink']= app()->config['WWW_SERVER'].app()->config['WWW_ROOT'].'/d/'.$finfo[0]['id']; $finfo[0]['removelink']=app()->config['WWW_SERVER'].app()->config['WWW_ROOT'].'/r/'.$finfo[0]['id'].'/'.$finfo[0]['remove']; In .htaccess, enter: RewriteEngine on RewriteRule ^([a-z])/([a-zA-Z0-9]+)$ /openupload/?a=$1&i=$2 [R,L] RewriteRule ^([a-z])/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)$ /openupload/?a=$1&i=$2&r=$3 [R,L] This works for me. I hope I didn't miss anything. Cheers Hasrald On Fri, 22 Oct 2010, Alessandro Briosi wrote: > Hi Harald. > > Il 21/10/2010 23:23, Harald Nikolaus ha scritto: >> Hi again, >> ... >> >> Oh, right. So what would be easier? I guess not using mod_rewrite means >> more rewriting in the application, does it? >> > Yes, this needs some coding. > > The simplest would be to have a redirect, to the page with the & version > So intercept the actions you need and redirect according, but haven't > looked deep enough yet. > > I guess that right now best way is go the mod_rewrite rule (and change > the links returned by the file.inc.php to the user > > Alessandro > > ------------------------------------------------------------------------------ > Nokia and AT&T present the 2010 Calling All Innovators-North America contest > Create new apps & games for the Nokia N8 for consumers in U.S. and Canada > $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store > http://p.sf.net/sfu/nokia-dev2dev > _______________________________________________ > Openupload-devel mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openupload-devel > |