diff --git a/keepassxc-browser/_locales/en/messages.json b/keepassxc-browser/_locales/en/messages.json
index 15f1ffc..8b839b0 100644
--- a/keepassxc-browser/_locales/en/messages.json
+++ b/keepassxc-browser/_locales/en/messages.json
@@ -992,7 +992,7 @@
"description": "Label for adding site manually on Site preferences tab."
},
"optionsSitePreferencesManualAddHelp": {
- "message": "The URL must start with either https://, http://, or ftp:// and must be at least 10 characters long.",
+ "message": "The URL must start with either https://, http://, file://, or ftp:// and must be at least 5 characters long.",
"description": "Help text for adding site manually on Site preferences tab."
},
"optionsSitePreferencesConfirmation": {
diff --git a/keepassxc-browser/common/global.js b/keepassxc-browser/common/global.js
index e8bdf29..9d92e89 100755
--- a/keepassxc-browser/common/global.js
+++ b/keepassxc-browser/common/global.js
@@ -12,7 +12,7 @@ const SORT_BY_USERNAME = 'sortByUsername';
const SORT_BY_GROUP_AND_TITLE = 'sortByGroupAndTitle';
const SORT_BY_GROUP_AND_USERNAME = 'sortByGroupAndUsername';
-const schemeSegment = '(\\*|http|https|ws|wss|file|ftp)';
+const schemeSegment = '(\\*|http|https|ws|wss|ftp)';
const hostSegment = '(\\*|(?:\\*\\.)?(?:[^/*]+))?';
const pathSegment = '(.*)';
@@ -61,6 +61,19 @@ const matchPatternToRegExp = function(pattern) {
return (/^(?:http|https|file|ftp|app):\/\//);
}
+ // special handling of file:// since there is no host
+ if (pattern.startsWith('file://')) {
+ let regex = '^';
+ pattern = pattern.replace(/\./g, '\\.');
+ if (pattern.endsWith('*')) {
+ regex += pattern.slice(0, -1);
+ }
+ else {
+ regex += `${pattern}$`;
+ }
+ return new RegExp(regex);
+ }
+
const matchPatternRegExp = new RegExp(
`^${schemeSegment}://${hostSegment}/${pathSegment}$`
);
diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html
index fa49abf..10c5329 100644
--- a/keepassxc-browser/options/options.html
+++ b/keepassxc-browser/options/options.html
@@ -541,7 +541,7 @@