Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

refactor(parsers): update volume parsing logic to use beforeLast and afterLast for improved accuracy

Andras Bacsaibe34c0c2b4de
diff --git a/bootstrap/helpers/parsers.php b/bootstrap/helpers/parsers.php
index 09898935b3..310d71c5dd 100644
--- a/bootstrap/helpers/parsers.php
+++ b/bootstrap/helpers/parsers.php
@@ -304,8 +304,8 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
$content = null;
$isDirectory = false;
if (is_string($volume)) {
- $source = str($volume)->before(':');
- $target = str($volume)->after(':')->beforeLast(':');
+ $source = str($volume)->beforeLast(':');
+ $target = str($volume)->afterLast(':');
$foundConfig = $fileStorages->whereMountPath($target)->first();
if (sourceIsLocal($source)) {
$type = str('bind');
@@ -399,8 +399,8 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
$name = "{$name}-pr-$pullRequestId";
}
if (is_string($volume)) {
- $source = str($volume)->before(':');
- $target = str($volume)->after(':')->beforeLast(':');
+ $source = str($volume)->beforeLast(':');
+ $target = str($volume)->afterLast(':');
$source = $name;
$volume = "$source:$target";
} elseif (is_array($volume)) {
@@ -1306,8 +1306,8 @@ function serviceParser(Service $resource): Collection
$content = null;
$isDirectory = false;
if (is_string($volume)) {
- $source = str($volume)->before(':');
- $target = str($volume)->after(':')->beforeLast(':');
+ $source = str($volume)->beforeLast(':');
+ $target = str($volume)->afterLast(':');
$foundConfig = $fileStorages->whereMountPath($target)->first();
if (sourceIsLocal($source)) {
$type = str('bind');
@@ -1395,8 +1395,8 @@ function serviceParser(Service $resource): Collection
$name = "{$uuid}_{$slugWithoutUuid}";
if (is_string($volume)) {
- $source = str($volume)->before(':');
- $target = str($volume)->after(':')->beforeLast(':');
+ $source = str($volume)->beforeLast(':');
+ $target = str($volume)->afterLast(':');
$source = $name;
$volume = "$source:$target";
} elseif (is_array($volume)) {