Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(files): Allow to configure Windows filename compatibility in the settings #46558

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Jul 16, 2024

Summary

This adds an admin setting to toggle Windows filename compatibility.

image

Checklist


public function setFilesWindowsSupport(bool $enabled = true): void {
if ($enabled) {
$basenames = array_unique(array_values(array_merge(self::WINDOWS_BASENAMES, $this->filenameValidator->getForbiddenBasenames())));

Check failure

Code scanning / Psalm

RedundantFunctionCall Error

The call to array_values is unnecessary, list{string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, ...} is already a list
public function setFilesWindowsSupport(bool $enabled = true): void {
if ($enabled) {
$basenames = array_unique(array_values(array_merge(self::WINDOWS_BASENAMES, $this->filenameValidator->getForbiddenBasenames())));
$characters = array_unique(array_values(array_merge(self::WINDOWS_CHARACTERS, $this->filenameValidator->getForbiddenCharacters())));

Check failure

Code scanning / Psalm

RedundantFunctionCall Error

The call to array_values is unnecessary, list{string, string, string, string, string, string, string, ...} is already a list
if ($enabled) {
$basenames = array_unique(array_values(array_merge(self::WINDOWS_BASENAMES, $this->filenameValidator->getForbiddenBasenames())));
$characters = array_unique(array_values(array_merge(self::WINDOWS_CHARACTERS, $this->filenameValidator->getForbiddenCharacters())));
$extensions = array_unique(array_values(array_merge(self::WINDOWS_EXTENSION, $this->filenameValidator->getForbiddenExtensions())));

Check failure

Code scanning / Psalm

RedundantFunctionCall Error

The call to array_values is unnecessary, list{string, string, ...} is already a list
@susnux susnux force-pushed the feat/add-setting-for-windows-compat branch 3 times, most recently from 9a34e3c to f0bba45 Compare July 17, 2024 11:32
@susnux susnux marked this pull request as ready for review July 17, 2024 11:32
@susnux susnux added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jul 17, 2024
@susnux susnux force-pushed the feat/add-setting-for-windows-compat branch from f0bba45 to b201a7e Compare July 17, 2024 11:39
apps/files/lib/Service/SettingsService.php Outdated Show resolved Hide resolved
@susnux susnux force-pushed the feat/add-setting-for-windows-compat branch from eeac0e1 to 74aac75 Compare July 17, 2024 12:57
@susnux susnux requested a review from artonge July 17, 2024 14:16
… settings

This adds an admin setting to toggle Windows filename compatibility.

Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Co-authored-by: Louis <louis@chmn.me>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux susnux force-pushed the feat/add-setting-for-windows-compat branch from f5ca3d6 to 0936af9 Compare July 17, 2024 14:17
Comment on lines +33 to +37
$event->setValue(
match($event->getFieldId()) {
'windows_support' => $this->service->hasFilesWindowsSupport(),
}
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Readability nitpick

Suggested change
$event->setValue(
match($event->getFieldId()) {
'windows_support' => $this->service->hasFilesWindowsSupport(),
}
);
if ($event->getFieldId() === 'windows_support') {
$event->setValue($this->service->hasFilesWindowsSupport());
}

@susnux susnux merged commit 1d77a38 into master Jul 19, 2024
166 checks passed
@susnux susnux deleted the feat/add-setting-for-windows-compat branch July 19, 2024 15:21
@blizzz blizzz mentioned this pull request Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants