From 0b2125aad6b70d446fbfb0567ffbb02cc4d4de34 Mon Sep 17 00:00:00 2001 From: Benedek Nagy Date: Mon, 18 Apr 2022 22:23:09 +0000 Subject: [PATCH] sharing: put file path between quotation marks Reviewed-by: Sunil Mohan Adapa --- actions/sharing | 4 ++-- plinth/modules/sharing/forms.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/actions/sharing b/actions/sharing index b3298dd97..d598aeba0 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 + '"' groups = arguments.groups is_public = arguments.is_public url = '/share/' + name @@ -154,7 +154,7 @@ def _list(aug=None): name = _get_name_from_url(url) shares.append({ 'name': name, - 'path': path, + 'path': path.strip('"'), 'url': '/share/' + name }) except ValueError: diff --git a/plinth/modules/sharing/forms.py b/plinth/modules/sharing/forms.py index b70782d12..cb245f4d6 100644 --- a/plinth/modules/sharing/forms.py +++ b/plinth/modules/sharing/forms.py @@ -20,8 +20,9 @@ class AddShareForm(forms.Form): 'A lowercase alpha-numeric string that uniquely identifies a ' 'share. Example: media.')) - path = forms.CharField( - label=_('Path to share'), strip=True, help_text=_( + path = forms.RegexField( + label=_('Path to share'), strip=True, regex=r'^[^\"]+$', + help_text=_( 'Disk path to a folder on this server that you intend to share.')) is_public = forms.BooleanField(