refactor(parsers): update volume parsing logic to use beforeLast and afterLast for improved accuracy
This commit is contained in:
parent
1675c85d4d
commit
be34c0c2b4
1 changed files with 8 additions and 8 deletions
|
|
@ -304,8 +304,8 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
|
||||||
$content = null;
|
$content = null;
|
||||||
$isDirectory = false;
|
$isDirectory = false;
|
||||||
if (is_string($volume)) {
|
if (is_string($volume)) {
|
||||||
$source = str($volume)->before(':');
|
$source = str($volume)->beforeLast(':');
|
||||||
$target = str($volume)->after(':')->beforeLast(':');
|
$target = str($volume)->afterLast(':');
|
||||||
$foundConfig = $fileStorages->whereMountPath($target)->first();
|
$foundConfig = $fileStorages->whereMountPath($target)->first();
|
||||||
if (sourceIsLocal($source)) {
|
if (sourceIsLocal($source)) {
|
||||||
$type = str('bind');
|
$type = str('bind');
|
||||||
|
|
@ -399,8 +399,8 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
|
||||||
$name = "{$name}-pr-$pullRequestId";
|
$name = "{$name}-pr-$pullRequestId";
|
||||||
}
|
}
|
||||||
if (is_string($volume)) {
|
if (is_string($volume)) {
|
||||||
$source = str($volume)->before(':');
|
$source = str($volume)->beforeLast(':');
|
||||||
$target = str($volume)->after(':')->beforeLast(':');
|
$target = str($volume)->afterLast(':');
|
||||||
$source = $name;
|
$source = $name;
|
||||||
$volume = "$source:$target";
|
$volume = "$source:$target";
|
||||||
} elseif (is_array($volume)) {
|
} elseif (is_array($volume)) {
|
||||||
|
|
@ -1306,8 +1306,8 @@ function serviceParser(Service $resource): Collection
|
||||||
$content = null;
|
$content = null;
|
||||||
$isDirectory = false;
|
$isDirectory = false;
|
||||||
if (is_string($volume)) {
|
if (is_string($volume)) {
|
||||||
$source = str($volume)->before(':');
|
$source = str($volume)->beforeLast(':');
|
||||||
$target = str($volume)->after(':')->beforeLast(':');
|
$target = str($volume)->afterLast(':');
|
||||||
$foundConfig = $fileStorages->whereMountPath($target)->first();
|
$foundConfig = $fileStorages->whereMountPath($target)->first();
|
||||||
if (sourceIsLocal($source)) {
|
if (sourceIsLocal($source)) {
|
||||||
$type = str('bind');
|
$type = str('bind');
|
||||||
|
|
@ -1395,8 +1395,8 @@ function serviceParser(Service $resource): Collection
|
||||||
$name = "{$uuid}_{$slugWithoutUuid}";
|
$name = "{$uuid}_{$slugWithoutUuid}";
|
||||||
|
|
||||||
if (is_string($volume)) {
|
if (is_string($volume)) {
|
||||||
$source = str($volume)->before(':');
|
$source = str($volume)->beforeLast(':');
|
||||||
$target = str($volume)->after(':')->beforeLast(':');
|
$target = str($volume)->afterLast(':');
|
||||||
$source = $name;
|
$source = $name;
|
||||||
$volume = "$source:$target";
|
$volume = "$source:$target";
|
||||||
} elseif (is_array($volume)) {
|
} elseif (is_array($volume)) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue