sharing: put file path between quotation marks

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Benedek Nagy 2022-04-18 22:23:09 +00:00 committed by Sunil Mohan Adapa
parent e8b224982f
commit 0b2125aad6
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 5 additions and 4 deletions

View File

@ -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:

View File

@ -20,8 +20,9 @@ class AddShareForm(forms.Form):
'A lowercase alpha-numeric string that uniquely identifies a '
'share. Example: <em>media</em>.'))
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(