Skip to content
Merged
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
4 changes: 2 additions & 2 deletions lib/Service/SettingsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function set(string $uid, array $settings) : void {
$settings[$name] = $value = $this->attrs[$name]['validate']($value);
}
if (!array_key_exists($name, $this->attrs)
|| empty($value)
|| $value === null
|| $value === $this->attrs[$name]['default']
) {
unset($settings[$name]);
Expand All @@ -123,7 +123,7 @@ public function getAll(string $uid) : \stdClass {
// use default for empty settings
$toBeSaved = false;
foreach ($this->attrs as $name => $attr) {
if (!property_exists($settings, $name) || empty($settings->{$name})) {
if (!property_exists($settings, $name)) {
$defaultValue = $attr['default'];
if (is_callable($defaultValue)) {
$settings->{$name} = $defaultValue($uid);
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
v-model="settings.notesPath"
type="text"
name="notesPath"
:placeholder="t('notes', 'path to notes')"
:placeholder="t('notes', 'root directory')"
@change="onChangeSettingsReload"
><input type="submit" class="icon-confirm" value="">
</form>
Expand Down
3 changes: 3 additions & 0 deletions tests/api/APIv1Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ public function testSettings(array $refNotes, \stdClass $settings) : void {
], (object)[
'notesPath' => 'New-Test-Notes-Folder2',
], 'Update notesPath with path traversal check');
$this->updateSettings($settings, (object)[
'notesPath' => '',
], (object)[], 'Update notesPath with root directory');
$this->updateSettings($settings, (object)[
'fileSuffix' => 'illegal value',
], (object)[
Expand Down