Skip to content

Commit

Permalink
Do not try to fetch last modified date if remote file (#707)
Browse files Browse the repository at this point in the history
If the file given in the artifact is not local, then the code should not
attempt to fetch the last modified date.

This applies to cases where the file is "-" meaning standard input and
artifacts with a URL when targeting GitHub repos and such.

Signed-off-by: Eric Brown <eric.brown@securesauce.dev>
  • Loading branch information
ericwb authored Dec 14, 2024
1 parent ce033f9 commit 1be62b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion precli/core/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, file_name: str, uri: Optional[str] = None):
self._encoding = "utf-8"
self._language = None

if file_name != "-" or not uri:
if file_name != "-" and not uri:
modified_time = os.path.getmtime(file_name)
self._last_modified = datetime.fromtimestamp(
modified_time, tz=timezone.utc
Expand Down

0 comments on commit 1be62b5

Please sign in to comment.