mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
fix extname for getimagepublicurlofobject (#30830)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
b2762be57d
commit
e45bf5c487
|
|
@ -1064,8 +1064,8 @@ function getImagePublicURLOfObject($object, $no = 1, $extName = '')
|
|||
} else {
|
||||
$image_path = '/wrapper.php?hashp='.urlencode($obj->share);
|
||||
}
|
||||
|
||||
if ($extName) {
|
||||
//getImageFileNameForSize($dir.$file, '_small')
|
||||
$image_path .= '&extname='.urlencode($extName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|||
$action = GETPOST('action', 'aZ09');
|
||||
$original_file = GETPOST('file', 'alphanohtml');
|
||||
$hashp = GETPOST('hashp', 'aZ09', 1);
|
||||
$extname = GETPOST('extname', 'alpha', 1);
|
||||
$modulepart = GETPOST('modulepart', 'alpha', 1);
|
||||
$urlsource = GETPOST('urlsource', 'alpha');
|
||||
$entity = (GETPOSTINT('entity') ? GETPOSTINT('entity') : $conf->entity);
|
||||
|
|
@ -204,6 +205,7 @@ if (GETPOST("cache", 'alpha')) {
|
|||
// If we have a hash public (hashp), we guess the original_file.
|
||||
if (!empty($hashp)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
$ecmfile = new EcmFiles($db);
|
||||
$result = $ecmfile->fetch(0, '', '', '', $hashp);
|
||||
if ($result > 0) {
|
||||
|
|
@ -226,6 +228,10 @@ if (!empty($hashp)) {
|
|||
$modulepart = $moduleparttocheck;
|
||||
$original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir
|
||||
}
|
||||
|
||||
if ($extname) {
|
||||
$original_file = getImageFileNameForSize($original_file, $extname);
|
||||
}
|
||||
} else {
|
||||
httponly_accessforbidden("ErrorFileNotFoundWithSharedLink", 403, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ $encoding = '';
|
|||
|
||||
// Parameters to download files
|
||||
$hashp = GETPOST('hashp', 'aZ09');
|
||||
$extname = GETPOST('extname', 'alpha', 1);
|
||||
$modulepart = GETPOST('modulepart', 'aZ09');
|
||||
$entity = GETPOSTINT('entity') ? GETPOSTINT('entity') : $conf->entity;
|
||||
$original_file = GETPOST("file", "alpha");
|
||||
|
|
@ -29,6 +30,7 @@ if ($rss) {
|
|||
// If we have a hash public (hashp), we guess the original_file.
|
||||
if (!empty($hashp)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
$ecmfile = new EcmFiles($db);
|
||||
$result = $ecmfile->fetch(0, '', '', '', $hashp);
|
||||
if ($result > 0) {
|
||||
|
|
@ -51,6 +53,10 @@ if (!empty($hashp)) {
|
|||
$modulepart = $moduleparttocheck;
|
||||
$original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir
|
||||
}
|
||||
|
||||
if ($extname) {
|
||||
$original_file = getImageFileNameForSize($original_file, $extname);
|
||||
}
|
||||
} else {
|
||||
print "ErrorFileNotFoundWithSharedLink";
|
||||
exit;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user