refactor(parsers): update volume parsing logic to use beforeLast and afterLast for improved accuracy
This commit is contained in:
@@ -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)) {
|
||||||
|
Reference in New Issue
Block a user