Skip to content

Conversation

@susnux
Copy link
Contributor

@susnux susnux commented Jul 11, 2024

Summary

When checking for public (web) access to the data directory the status is not enough as you might have a webserver that forwards to e.g. a login page. So instead check that the content of the file matches.

For this the .ncdata file (renamed from .ocdata¹) has minimal text content to allow checking.

¹The file was renamed from the legacy .ocdata, there is a repair step to remove the old one.

Checklist

@susnux susnux added bug 3. to review Waiting for reviews ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) labels Jul 11, 2024
@susnux susnux added this to the Nextcloud 30 milestone Jul 11, 2024
@susnux susnux force-pushed the fix/check-datadir branch from 5415139 to 6f0b182 Compare July 11, 2024 19:03
$datadir = str_replace(\OC::$SERVERROOT . '/', '', $this->config->getSystemValue('datadirectory', ''));

$dataUrl = $this->urlGenerator->getWebroot() . '/' . $datadir . '/.ocdata';
$dataUrl = $this->urlGenerator->getWebroot() . '/' . $datadir . '/.ncdata';

Check notice

Code scanning / Psalm

PossiblyInvalidOperand

Cannot concatenate with a array<array-key, string>|string
@marcelklehr marcelklehr removed their request for review July 15, 2024 03:56
@blizzz blizzz mentioned this pull request Jul 30, 2024
@susnux susnux force-pushed the fix/check-datadir branch from 6f0b182 to 9cecc20 Compare July 30, 2024 12:03
Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@blizzz blizzz mentioned this pull request Aug 1, 2024
This was referenced Aug 5, 2024
@susnux susnux force-pushed the fix/check-datadir branch from 9cecc20 to b3e7a5e Compare August 8, 2024 16:15
@susnux susnux force-pushed the fix/check-datadir branch 3 times, most recently from e396b90 to 0ad5aeb Compare August 8, 2024 17:17
When checking for public (web) access to the data directory the status is not enough
as you might have a webserver that forwards to e.g. a login page.
So instead check that the content of the file matches.

For this the `.ncdata` file (renamed from `.ocdata`¹) has minimal text content
to allow checking.

¹The file was renamed from the legacy `.ocdata`, there is a repair step to remove the old one.

Signed-off-by: Ferdinand Thiessen <[email protected]>
@Altahrim Altahrim merged commit 1b8dbcb into master Aug 8, 2024
@Altahrim Altahrim deleted the fix/check-datadir branch August 8, 2024 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants