bugDolibarr - Bugs: bug #27469, Des documents ne peuvent plus...

 
 
Show feedback again

bug #27469: Des documents ne peuvent plus être téléchargés: urldecode superflu

Submitted by:  Sylvain Beucler <Beuc>
Submitted on:  Thu 17 Sep 2009 01:35:04 PM UTC  
 
Severity: 3 - NormalStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: ClosedRelease: 2.6.1
Operating System: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 02 Oct 2009 06:16:41 PM UTC, comment #1:

The bug was corrected inside CVS sources
Fix will be available in next release.

Laurent Destailleur <eldy>
Project Administrator
Thu 17 Sep 2009 01:35:04 PM UTC, original submission:

L'erreur se produit quand on tente de télécharger un fichier contenant un '+':

Dolibarr a détecté une erreur technique.
Voici les informations qui pourront aider au diagnostic:
Dolibarr: 2.6.1
Date: 20090917153026
Niveau de fonctionnalités: 0
Server: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny3 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g
Referer: https://XXX/dolibarr/comm/propal.php?propalid=68
Url sollicitée: /dolibarr/document.php?modulepart=propal&file=DV200906054%2F200906054-DevisSigne%2BBCClient.pdf
MenuManager: eldy_backoffice.php/eldy_backoffice.php

Message: Le fichier /var/www/public/dolibarr/documents/propale/DV200906054/200906054-DevisSigne BCClient.pdf n'existe pas

Le fichier document.php utile la fonction PHP 'urlencode' pour convertir le nom du document dans l'URL en nom de document pour le système de fichiers.

Hors, PHP a déjà fait cette opération. Par conséquent le résultat (stocké dans $original_file) subit le décodage 2 fois. Cela ne pose pas de problème dans le cas courant, quand le nom de fichier ne contient pas le signe '%' ou '+', mais cela rendre les autres documents impossible à télécharger.

Noter que $original_file est défini plusieurs fois: une fois tout en haut du fichier, plus sa valeur est réinitialisée plus bas (copier/coller).

La modification suivante corrige le problème:

cvs diff: Diffing .
Index: document.php
===================================================================
RCS file: /sources/dolibarr/dolibarr/htdocs/document.php,v
retrieving revision 1.66
diff -u -r1.66 document.php
--- document.php 24 Feb 2009 22:52:55 -0000 1.66
+++ document.php 17 Sep 2009 13:27:21 -0000
@@ -66,7 +66,7 @@
//$encoding='ISO-8859-1';

$action = $_GET["action"];
-$original_file = urldecode($_GET["file"]);
+$original_file = $_GET["file"];
$modulepart = urldecode($_GET["modulepart"]);
$urlsource = urldecode($_GET["urlsource"]);

Sylvain Beucler <Beuc>

 

(Note: upload size limit is set to 512 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by hregis (Updated the item)
  • -unavailable- added by Beuc (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter 421 here (basic anti-spam test):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 04 Nov 2009 05:53:56 AM UTChregisOpen/ClosedOpen=>Closed
    Fri 02 Oct 2009 06:16:41 PM UTCeldyStatusNone=>Fixed
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup