mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
prevent crash on windows due to lack of os.pathconf call
This commit is contained in:
@ -488,11 +488,12 @@ class DownloadQueue(DownloadQueueBase):
|
||||
self._update_job_status(job, DownloadJobStatus.ERROR)
|
||||
|
||||
def _validate_filename(self, directory: str, filename: str):
|
||||
pc_name_max = os.pathconf(directory, "PC_NAME_MAX") if hasattr(os, "pathconf") else 260
|
||||
if "/" in filename:
|
||||
raise ValueError
|
||||
if filename.startswith(".."):
|
||||
raise ValueError
|
||||
if len(filename) > os.pathconf(directory, "PC_NAME_MAX"):
|
||||
if len(filename) > pc_name_max:
|
||||
raise ValueError
|
||||
if len(os.path.join(directory, filename)) > os.pathconf(directory, "PC_PATH_MAX"):
|
||||
raise ValueError
|
||||
|
Reference in New Issue
Block a user