mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Restore original ./ stripping for template and VCS root directories
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f22c7425f7
commit
6ed54706b3
2 files changed
+12
-15
No files matched your search
@@ -297,10 +297,9 @@ class Builds extends Action
|
||||
$templateReferenceValue = $template->getAttribute('referenceValue', '');
|
||||
|
||||
$templateRootDirectory = $template->getAttribute('rootDirectory', '');
|
||||
$templateRootDirectory = \trim($templateRootDirectory, '/');
|
||||
if ($templateRootDirectory !== '' && \preg_match('#(^|/)\.\.(/|$)#', $templateRootDirectory)) {
|
||||
throw new \Exception('Invalid template root directory');
|
||||
}
|
||||
$templateRootDirectory = \rtrim($templateRootDirectory, '/');
|
||||
$templateRootDirectory = \ltrim($templateRootDirectory, '.');
|
||||
$templateRootDirectory = \ltrim($templateRootDirectory, '/');
|
||||
|
||||
if (! empty($templateRepositoryName) && ! empty($templateOwnerName) && ! empty($templateReferenceType) && ! empty($templateReferenceValue)) {
|
||||
$stdout = '';
|
||||
@@ -363,10 +362,9 @@ class Builds extends Action
|
||||
// VCS and VCS+Temaplte
|
||||
$tmpDirectory = '/tmp/builds/' . $deploymentId . '/code';
|
||||
$rootDirectory = $resource->getAttribute('providerRootDirectory', '');
|
||||
$rootDirectory = \trim($rootDirectory, '/');
|
||||
if ($rootDirectory !== '' && \preg_match('#(^|/)\.\.(/|$)#', $rootDirectory)) {
|
||||
throw new \Exception('Invalid root directory');
|
||||
}
|
||||
$rootDirectory = \rtrim($rootDirectory, '/');
|
||||
$rootDirectory = \ltrim($rootDirectory, '.');
|
||||
$rootDirectory = \ltrim($rootDirectory, '/');
|
||||
|
||||
$owner = $github->getOwnerName($providerInstallationId);
|
||||
$repositoryName = $github->getRepositoryName($providerRepositoryId);
|
||||
@@ -422,10 +420,9 @@ class Builds extends Action
|
||||
$templateReferenceValue = $template->getAttribute('referenceValue', '');
|
||||
|
||||
$templateRootDirectory = $template->getAttribute('rootDirectory', '');
|
||||
$templateRootDirectory = \trim($templateRootDirectory, '/');
|
||||
if ($templateRootDirectory !== '' && \preg_match('#(^|/)\.\.(/|$)#', $templateRootDirectory)) {
|
||||
throw new \Exception('Invalid template root directory');
|
||||
}
|
||||
$templateRootDirectory = \rtrim($templateRootDirectory, '/');
|
||||
$templateRootDirectory = \ltrim($templateRootDirectory, '.');
|
||||
$templateRootDirectory = \ltrim($templateRootDirectory, '/');
|
||||
|
||||
if (! empty($templateRepositoryName) && ! empty($templateOwnerName) && ! empty($templateReferenceType) && ! empty($templateReferenceValue)) {
|
||||
// Clone template repo
|
||||
|
||||
@@ -2274,7 +2274,7 @@ class SitesCustomServerTest extends Scope
|
||||
$deployment = $this->createTemplateDeployment($siteId, [
|
||||
'repository' => $template['providerRepositoryId'],
|
||||
'owner' => $template['providerOwner'],
|
||||
'rootDirectory' => \ltrim($template['frameworks'][0]['providerRootDirectory'], './'),
|
||||
'rootDirectory' => $template['frameworks'][0]['providerRootDirectory'],
|
||||
'type' => 'tag',
|
||||
'reference' => $template['providerVersion'],
|
||||
'activate' => true
|
||||
@@ -2345,7 +2345,7 @@ class SitesCustomServerTest extends Scope
|
||||
$deployment = $this->createTemplateDeployment($siteId, [
|
||||
'repository' => $template['providerRepositoryId'],
|
||||
'owner' => $template['providerOwner'],
|
||||
'rootDirectory' => \ltrim($template['frameworks'][0]['providerRootDirectory'], './'),
|
||||
'rootDirectory' => $template['frameworks'][0]['providerRootDirectory'],
|
||||
'type' => 'branch',
|
||||
'reference' => 'main',
|
||||
'activate' => true
|
||||
@@ -2423,7 +2423,7 @@ class SitesCustomServerTest extends Scope
|
||||
$deployment = $this->createTemplateDeployment($siteId, [
|
||||
'repository' => $template['providerRepositoryId'],
|
||||
'owner' => $template['providerOwner'],
|
||||
'rootDirectory' => \ltrim($template['frameworks'][0]['providerRootDirectory'], './'),
|
||||
'rootDirectory' => $template['frameworks'][0]['providerRootDirectory'],
|
||||
'type' => 'commit',
|
||||
'reference' => $latestCommit,
|
||||
'activate' => true
|
||||
|
||||
Reference in new issue
Block a user