mirror of
https://github.com/unraid/webgui.git
synced 2026-05-03 16:29:45 -05:00
Use user.LOCATION instead of user.LOCATIONS to dereference single file on user share.
This commit is contained in:
@@ -14,12 +14,10 @@ function detect_user_share(&$arg) {
|
||||
$arg = preg_replace_callback('|(/mnt/user/[^,]+\.[^,\s]*)|', function($match) {
|
||||
if (is_file($match[0])) {
|
||||
// resolve the actual disk or cache backing device for this user share path
|
||||
$realdisk = trim(shell_exec("getfattr --absolute-names -n user.LOCATIONS ".escapeshellarg($match[0])." 2>/dev/null|grep -Po '^user.LOCATIONS=\"\K[^\\\"]+'"));
|
||||
$realdisk = trim(shell_exec("getfattr --absolute-names --only-values -n user.LOCATION ".escapeshellarg($match[0])." 2>/dev/null"));
|
||||
|
||||
if (!empty($realdisk)) {
|
||||
// there may be several disks participating in this path (e.g. disk1,2,3) so
|
||||
// only return the first disk and replace 'user' with say 'cache' or 'disk1'
|
||||
$replacement = str_replace('/mnt/user/', '/mnt/'.strtok($realdisk.',', ',').'/', $match[0]);
|
||||
$replacement = str_replace('/mnt/user/', "/mnt/$realdisk/", $match[0]);
|
||||
|
||||
if (is_file($replacement)) {
|
||||
// the replacement path (e.g. /mnt/disk1/domains/vmname/vdisk1.img) checks out so use it
|
||||
@@ -40,4 +38,4 @@ foreach ($argv as $arg) {
|
||||
$whole_cmd .= escapeshellarg($arg).' ';
|
||||
}
|
||||
|
||||
echo trim($whole_cmd);
|
||||
echo trim($whole_cmd);
|
||||
|
||||
Reference in New Issue
Block a user