Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,10 @@ public function createBackup(): void {
}

foreach ($this->getRecursiveDirectoryIterator($this->nextcloudDir, $excludedElements) as $absolutePath => $fileInfo) {
$relativePath = explode($this->nextcloudDir, $absolutePath)[1];
$relativePath = explode($this->nextcloudDir, $absolutePath, 2)[1] ?? null;
if ($relativePath === null) {
throw new \Exception($absolutePath . ' is not in ' . $this->nextcloudDir);
}
$relativeDirectory = dirname($relativePath);

// Create folder if it doesn't exist
Expand Down
5 changes: 4 additions & 1 deletion lib/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,10 @@ public function createBackup(): void {
}

foreach ($this->getRecursiveDirectoryIterator($this->nextcloudDir, $excludedElements) as $absolutePath => $fileInfo) {
$relativePath = explode($this->nextcloudDir, $absolutePath)[1];
$relativePath = explode($this->nextcloudDir, $absolutePath, 2)[1] ?? null;
if ($relativePath === null) {
throw new \Exception($absolutePath . ' is not in ' . $this->nextcloudDir);
}
$relativeDirectory = dirname($relativePath);

// Create folder if it doesn't exist
Expand Down
2 changes: 1 addition & 1 deletion tests/checkSameCodeBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function findDiffPos($original, $copy) {
* @var SplFileInfo $fileInfo
*/
foreach ($iterator as $path => $fileInfo) {
$fileName = explode($libDir, $path)[1];
$fileName = explode($libDir, $path, 2)[1];

if (array_search($fileName, $excludedFiles) !== false) {
continue;
Expand Down