diff --git a/actions/sharing b/actions/sharing index d598aeba0..1cfeb35f1 100755 --- a/actions/sharing +++ b/actions/sharing @@ -57,7 +57,7 @@ def load_augeas(): def subcommand_add(arguments): """Add a share to Apache configuration.""" name = arguments.name - path = '"' + arguments.path + '"' + path = '"' + arguments.path.replace('"', r'\"') + '"' groups = arguments.groups is_public = arguments.is_public url = '/share/' + name @@ -150,11 +150,13 @@ def _list(aug=None): url = aug.get(match + '/arg[1]') path = aug.get(match + '/arg[2]') + path = path.removesuffix('"').removeprefix('"') + path = path.replace(r'\"', '"') try: name = _get_name_from_url(url) shares.append({ 'name': name, - 'path': path.strip('"'), + 'path': path, 'url': '/share/' + name }) except ValueError: diff --git a/plinth/modules/sharing/forms.py b/plinth/modules/sharing/forms.py index cb245f4d6..b70782d12 100644 --- a/plinth/modules/sharing/forms.py +++ b/plinth/modules/sharing/forms.py @@ -20,9 +20,8 @@ class AddShareForm(forms.Form): 'A lowercase alpha-numeric string that uniquely identifies a ' 'share. Example: media.')) - path = forms.RegexField( - label=_('Path to share'), strip=True, regex=r'^[^\"]+$', - help_text=_( + path = forms.CharField( + label=_('Path to share'), strip=True, help_text=_( 'Disk path to a folder on this server that you intend to share.')) is_public = forms.BooleanField(