mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
pÃrevent storing files/folder with filenames exceeding their max name length
This commit is contained in:
@@ -796,6 +796,12 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen($filename) > MAX_FILENAME_LENGTH) {
|
||||
logger('filename too long');
|
||||
$ret['message'] = t('Filename too long');
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if(! $hash)
|
||||
$hash = new_uuid();
|
||||
|
||||
@@ -1185,6 +1191,12 @@ function attach_mkdir($channel, $observer_hash, $arr = null) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if(strlen($arr['filename']) > MAX_FOLDER_LENGTH) {
|
||||
logger('pathname too long');
|
||||
$ret['message'] = t('Pathname too long');
|
||||
return $ret;
|
||||
}
|
||||
|
||||
$arr['hash'] = $arr['hash'] ?? new_uuid();
|
||||
|
||||
// Check for duplicate name.
|
||||
@@ -2589,6 +2601,11 @@ function attach_move($channel_id, $resource_id, $new_folder_hash, $newname = '',
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen($filename) > MAX_FILENAME_LENGTH) {
|
||||
logger('filename too long');
|
||||
$ret['message'] = t('Filename too long');
|
||||
return $ret;
|
||||
}
|
||||
|
||||
q("update attach set content = '%s', folder = '%s', filename = '%s', edited = '%s' where id = %d",
|
||||
dbescbin($newstorepath),
|
||||
|
||||
Reference in New Issue
Block a user