Merge branch 'master' into #5461-Inadvertently-logged-out-because-of-timeout-integer-overflow

This commit is contained in:
MSomnium Studios 2025-10-17 10:55:23 -04:00 committed by GitHub
commit 60e3508424
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 17 deletions

View File

@ -8,6 +8,7 @@ import (
"net/http"
"os"
"os/exec"
"slices"
"strings"
fbErrors "github.com/filebrowser/filebrowser/v2/errors"
@ -266,13 +267,7 @@ var validHookFields = []string{
// IsValid checks if the provided field is on the valid fields list
func (hf *hookFields) IsValid(field string) bool {
for _, val := range validHookFields {
if field == val {
return true
}
}
return false
return slices.Contains(validHookFields, field)
}
// GetString returns the string value or provided default

View File

@ -17,7 +17,7 @@
</button>
<button
class="button button--flat button--blue"
@click="saveAndClose"
@click="currentPrompt.saveAction"
:aria-label="$t('buttons.saveChanges')"
:title="$t('buttons.saveChanges')"
tabindex="1"
@ -39,8 +39,8 @@
</template>
<script>
import { mapState, mapActions } from "pinia";
import { useLayoutStore } from "@/stores/layout";
import { mapActions, mapState } from "pinia";
export default {
name: "discardEditorChanges",
@ -49,12 +49,6 @@ export default {
},
methods: {
...mapActions(useLayoutStore, ["closeHovers"]),
saveAndClose() {
if (this.currentPrompt?.saveAction) {
this.currentPrompt.saveAction();
}
this.closeHovers();
},
},
};
</script>

View File

@ -216,12 +216,24 @@ const decreaseFontSize = () => {
const close = () => {
if (!editor.value?.session.getUndoManager().isClean()) {
layoutStore.showHover("discardEditorChanges");
layoutStore.showHover({
prompt: "discardEditorChanges",
confirm: (event: Event) => {
event.preventDefault();
finishClose();
},
saveAction: async () => {
await save();
finishClose();
},
});
return;
}
finishClose();
};
const finishClose = () => {
fileStore.updateRequest(null);
const uri = url.removeLastDir(route.path) + "/";
router.push({ path: uri });
};