Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
Stop automatically populating File model name field with external sou…
Browse files Browse the repository at this point in the history
…rce URLs
  • Loading branch information
rjmello committed Aug 18, 2022
1 parent 8b5f90f commit 1c3eab8
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/cript/nodes/primary/file.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
from typing import Union
from logging import getLogger
from urllib.parse import urlparse

from beartype import beartype

Expand Down Expand Up @@ -76,11 +75,8 @@ def source(self, value):

self.name = os.path.basename(value)
self.extension = os.path.splitext(value)[-1]

elif value.startswith(("http://", "https://")):
parsed_url = urlparse(value)
self.name = parsed_url.netloc + parsed_url.path

pass
else:
raise FileNotFoundError(
"The file could not be found on the local filesystem."
Expand Down

0 comments on commit 1c3eab8

Please sign in to comment.