Skip to content

Commit

Permalink
chore: WIP - debug for CI
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
  • Loading branch information
come-nc committed Jan 20, 2025
1 parent 14b8770 commit bfbc787
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/files_versions/tests/VersioningTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,10 @@ public function testMoveFileIntoSharedFolderAsRecipient(): void {
// move file into the shared folder as recipient
$success = Filesystem::rename('/test.txt', '/folder1/test.txt');

$this->assertTrue($success);
// TODO: Voir is $v2 existe pour voir si c’est la copie ou la suppression qui foire
// Mettre du debug dans Wrapper/Encrytion::copyBetweenStorage c’est le suspect n-1
var_dump(['success' => $success, 'v1 exists' => $this->rootView->file_exists($v1), 'v2 exists' => $this->rootView->file_exists($v2)]);
$this->assertTrue($success); // renvoi true :-O
$this->assertFalse($this->rootView->file_exists($v1));
$this->assertFalse($this->rootView->file_exists($v2));

Expand Down
8 changes: 8 additions & 0 deletions lib/private/Files/Storage/Wrapper/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,20 +522,25 @@ public function moveFromStorage(
// - remove $this->copyBetweenStorage

if (!$sourceStorage->isDeletable($sourceInternalPath)) {
echo "[DEBUG] $sourceInternalPath $targetInternalPath not deletable " . __FILE__ . ':' . __LINE__ . "\n";

Check failure

Code scanning / Psalm

TaintedHtml Error

Detected tainted HTML

Check failure

Code scanning / Psalm

TaintedTextWithQuotes Error

Detected tainted text with possible quotes

Check failure on line 525 in lib/private/Files/Storage/Wrapper/Encryption.php

View workflow job for this annotation

GitHub Actions / static-code-analysis-security

TaintedHtml

lib/private/Files/Storage/Wrapper/Encryption.php:525:9: TaintedHtml: Detected tainted HTML (see https://psalm.dev/245)

Check failure on line 525 in lib/private/Files/Storage/Wrapper/Encryption.php

View workflow job for this annotation

GitHub Actions / static-code-analysis-security

TaintedTextWithQuotes

lib/private/Files/Storage/Wrapper/Encryption.php:525:9: TaintedTextWithQuotes: Detected tainted text with possible quotes (see https://psalm.dev/274)
return false;
}

$result = $this->copyBetweenStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime, true);
echo "[DEBUG] $sourceInternalPath $targetInternalPath copy:$result " . __FILE__ . ':' . __LINE__ . "\n";

Check failure

Code scanning / Psalm

TaintedHtml Error

Detected tainted HTML

Check failure

Code scanning / Psalm

TaintedTextWithQuotes Error

Detected tainted text with possible quotes

Check failure on line 530 in lib/private/Files/Storage/Wrapper/Encryption.php

View workflow job for this annotation

GitHub Actions / static-code-analysis-security

TaintedHtml

lib/private/Files/Storage/Wrapper/Encryption.php:530:8: TaintedHtml: Detected tainted HTML (see https://psalm.dev/245)

Check failure on line 530 in lib/private/Files/Storage/Wrapper/Encryption.php

View workflow job for this annotation

GitHub Actions / static-code-analysis-security

TaintedTextWithQuotes

lib/private/Files/Storage/Wrapper/Encryption.php:530:8: TaintedTextWithQuotes: Detected tainted text with possible quotes (see https://psalm.dev/274)
if ($result) {
echo "[DEBUG] $sourceInternalPath $targetInternalPath copy success " . __FILE__ . ':' . __LINE__ . "\n";

Check failure

Code scanning / Psalm

TaintedHtml Error

Detected tainted HTML

Check failure

Code scanning / Psalm

TaintedTextWithQuotes Error

Detected tainted text with possible quotes

Check failure on line 532 in lib/private/Files/Storage/Wrapper/Encryption.php

View workflow job for this annotation

GitHub Actions / static-code-analysis-security

TaintedHtml

lib/private/Files/Storage/Wrapper/Encryption.php:532:9: TaintedHtml: Detected tainted HTML (see https://psalm.dev/245)

Check failure on line 532 in lib/private/Files/Storage/Wrapper/Encryption.php

View workflow job for this annotation

GitHub Actions / static-code-analysis-security

TaintedTextWithQuotes

lib/private/Files/Storage/Wrapper/Encryption.php:532:9: TaintedTextWithQuotes: Detected tainted text with possible quotes (see https://psalm.dev/274)
if ($sourceStorage->instanceOfStorage(ObjectStoreStorage::class)) {
/** @var ObjectStoreStorage $sourceStorage */
$sourceStorage->setPreserveCacheOnDelete(true);
}
try {
if ($sourceStorage->is_dir($sourceInternalPath)) {
$result = $sourceStorage->rmdir($sourceInternalPath);
echo "[DEBUG] $sourceInternalPath rmdir:$result " . __FILE__ . ':' . __LINE__ . "\n";
} else {
$result = $sourceStorage->unlink($sourceInternalPath);
echo "[DEBUG] $sourceInternalPath unlink:$result " . __FILE__ . ':' . __LINE__ . "\n";
}
} finally {
if ($sourceStorage->instanceOfStorage(ObjectStoreStorage::class)) {
Expand Down Expand Up @@ -621,10 +626,12 @@ private function copyBetweenStorage(
bool $preserveMtime,
bool $isRename,
): bool {
echo "[DEBUG] $sourceInternalPath $targetInternalPath $isRename " . __FILE__ . ':' . __LINE__ . "\n";

Check failure

Code scanning / Psalm

TaintedHtml Error

Detected tainted HTML

Check failure

Code scanning / Psalm

TaintedTextWithQuotes Error

Detected tainted text with possible quotes

Check failure on line 629 in lib/private/Files/Storage/Wrapper/Encryption.php

View workflow job for this annotation

GitHub Actions / static-code-analysis-security

TaintedHtml

lib/private/Files/Storage/Wrapper/Encryption.php:629:8: TaintedHtml: Detected tainted HTML (see https://psalm.dev/245)

Check failure on line 629 in lib/private/Files/Storage/Wrapper/Encryption.php

View workflow job for this annotation

GitHub Actions / static-code-analysis-security

TaintedTextWithQuotes

lib/private/Files/Storage/Wrapper/Encryption.php:629:8: TaintedTextWithQuotes: Detected tainted text with possible quotes (see https://psalm.dev/274)
// for versions we have nothing to do, because versions should always use the
// key from the original file. Just create a 1:1 copy and done
if ($this->isVersion($targetInternalPath) ||
$this->isVersion($sourceInternalPath)) {
echo "[DEBUG] $sourceInternalPath $targetInternalPath $isRename " . __FILE__ . ':' . __LINE__ . "\n";

Check failure

Code scanning / Psalm

TaintedHtml Error

Detected tainted HTML

Check failure

Code scanning / Psalm

TaintedTextWithQuotes Error

Detected tainted text with possible quotes
// remember that we try to create a version so that we can detect it during
// fopen($sourceInternalPath) and by-pass the encryption in order to
// create a 1:1 copy of the file
Expand All @@ -642,6 +649,7 @@ private function copyBetweenStorage(
}
$this->updateEncryptedVersion($sourceStorage, $sourceInternalPath, $targetInternalPath, $isRename, true);
}
echo "[DEBUG] $result " . __FILE__ . ':' . __LINE__ . "\n";
return $result;
}

Expand Down

0 comments on commit bfbc787

Please sign in to comment.