Raise a error is path is not available

This commit is contained in:
Josué Tille 2018-12-30 22:32:47 +01:00
parent 412c656a9b
commit d656d5b4ba
No known key found for this signature in database
GPG key ID: D5E068C6DFA8681D

View file

@ -464,7 +464,18 @@ def app_change_url(operation_logger, auth, app, domain, path):
if (domain, path) == (old_domain, old_path):
raise YunohostError("app_change_url_identical_domains", domain=domain, path=path)
_get_conflicting_apps(auth, domain, path)
# Check the url is available
conflicts = _get_conflicting_apps(auth, domain, path)
if conflicts:
apps = []
for path, app_id, app_label in conflicts:
apps.append(" * {domain:s}{path:s}{app_label:s} ({app_id:s})".format(
domain=domain,
path=path,
app_id=app_id,
app_label=app_label,
))
raise YunohostError('app_location_unavailable', apps="\n".join(apps))
manifest = json.load(open(os.path.join(APPS_SETTING_PATH, app, "manifest.json")))