Skip to content

Commit

Permalink
Fix check network drive on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Oct 9, 2023
1 parent 60794b7 commit de7e8d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

* Fix an error on Windows when the path of a layer is on a different drive

## 3.17.1 - 2023-10-04

* Add links to the corresponding blog post announcing a new release, if available
Expand Down
12 changes: 11 additions & 1 deletion lizmap/saas.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,17 @@ def valid_saas_lizmap_dot_com(project: QgsProject) -> Tuple[bool, Dict[str, str]
# Let's skip, QGIS is already warning this layer
continue

relative_path = relpath(layer_path, project_home)
try:
relative_path = relpath(layer_path, project_home)
except ValueError:
# https://docs.python.org/3/library/os.path.html#os.path.relpath
# On Windows, ValueError is raised when path and start are on different drives.
# For instance, H: and C:
layer_error[layer.name()] = tr(
'The layer "{}" can not be hosted on lizmap.com because the layer is hosted on a different drive.'
).format(layer.name())
continue

if '../../..' in relative_path:
# The layer can only be hosted the in "/qgis" directory
layer_error[layer.name()] = tr(
Expand Down

0 comments on commit de7e8d5

Please sign in to comment.