Skip to content

Commit

Permalink
fix: do not consider URL-like queries as valid
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Apr 16, 2024
1 parent 7b3043b commit bb0cd39
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions snakemake_storage_plugin_fs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import shutil
import subprocess
from typing import Any, Iterable, List, Optional
from urllib.parse import urlparse

import sysrsync

Expand Down Expand Up @@ -79,6 +80,16 @@ def is_valid_query(cls, query: str) -> StorageQueryValidationResult:
# Ensure that also queries containing wildcards (e.g. {sample}) are accepted
# and considered valid. The wildcards will be resolved before the storage
# object is actually used.

# disallow queries that are URL like
parsed = urlparse(query)
if parsed.scheme:
return StorageQueryValidationResult(
query=query,
valid=False,
message="Query is URL-like, but should be a system path instead.",
)

try:
Path(query)
except Exception:
Expand Down

0 comments on commit bb0cd39

Please sign in to comment.