Skip to content

Commit 6a1b667

Browse files
committed
improve(qconfig-global): use util to determine filename from remote URL
Util has been introduced in #830 Funded by Oslandia <!-- osl:grant-oss-2026 -->
1 parent b5464fe commit 6a1b667

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

qgis_deployment_toolbelt/jobs/job_qglobal_config_manager.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@
1313
from posixpath import expanduser, expandvars
1414
from shutil import copy2
1515
from sys import platform as opersys
16-
from urllib.parse import urlsplit
1716

1817
# package
1918
from qgis_deployment_toolbelt.constants import OSConfiguration
2019
from qgis_deployment_toolbelt.jobs.generic_job import GenericJob
2120
from qgis_deployment_toolbelt.profiles.qgis_ini_handler import QgisIniHelper
2221
from qgis_deployment_toolbelt.utils.file_downloader import download_remote_file_to_local
23-
from qgis_deployment_toolbelt.utils.slugger import sluggy
2422
from qgis_deployment_toolbelt.utils.str2bool import str2bool
25-
from qgis_deployment_toolbelt.utils.url_helpers import check_str_is_url
23+
from qgis_deployment_toolbelt.utils.url_helpers import (
24+
check_str_is_url,
25+
filename_from_url,
26+
)
2627

2728

2829
# conditional imports
@@ -256,12 +257,8 @@ def get_remote_qgis_global_settings_from_url(self, remote_url: str) -> Path:
256257
"""
257258
# try to build file path from URL
258259
try:
259-
url_splitted = urlsplit(remote_url)
260260
local_filepath_for_remote_global_settings = (
261-
"remote_qgis_global_settings/"
262-
f"{sluggy(url_splitted.netloc)}/"
263-
f"{sluggy(str(Path(url_splitted.path).parent))}/"
264-
f"{Path(url_splitted.path).name}"
261+
f"remote_qgis_global_settings/{filename_from_url(remote_url)}"
265262
)
266263
except Exception as err:
267264
local_filepath_for_remote_global_settings = (

0 commit comments

Comments
 (0)