Closed nizamuddin closed 1 year ago
We need to check the image in S3 bucket first, if not available then we need to send to API. This feature is not working.
Maybe ai dev changes the functions slightly.
def relative_filepath(self) -> str: protocol_stripped_url = ( self.unquoted_url.split("?")[0] .replace("http://", "") .replace("https://", "") .replace("--", "_") .replace("%", "") ) relative_folder = "/".join(protocol_stripped_url.split("/")[:-1]) if len(self.query_params): relative_folder = f"{relative_folder}/{self.query_params}" filename_with_extension = protocol_stripped_url.split("/")[-1] filename_parts = filename_with_extension.split(".") if len(filename_parts) >= 2: filename = ".".join(filename_parts[:-1]) extension = filename_parts[-1] if extension.lower() not in ["jpeg", "jpg", "png", "webp"]: filename = f"{filename}.{extension}" extension = ".jpg" else: if len(filename_parts[0]): filename = filename_parts[0] else: filename = "image" extension = "jpg" return f"{relative_folder}/{filename}.{extension}"
I have added these extra lines.
if extension.lower() not in ["jpeg", "jpg", "png", "webp"]: filename = f"{filename}.{extension}" extension = ".jpg" (edited)
We need to check the image in S3 bucket first, if not available then we need to send to API. This feature is not working.
Maybe ai dev changes the functions slightly.
def relative_filepath(self) -> str: protocol_stripped_url = ( self.unquoted_url.split("?")[0] .replace("http://", "") .replace("https://", "") .replace("--", "_") .replace("%", "") ) relative_folder = "/".join(protocol_stripped_url.split("/")[:-1]) if len(self.query_params): relative_folder = f"{relative_folder}/{self.query_params}" filename_with_extension = protocol_stripped_url.split("/")[-1] filename_parts = filename_with_extension.split(".") if len(filename_parts) >= 2: filename = ".".join(filename_parts[:-1]) extension = filename_parts[-1] if extension.lower() not in ["jpeg", "jpg", "png", "webp"]: filename = f"{filename}.{extension}" extension = ".jpg" else: if len(filename_parts[0]): filename = filename_parts[0] else: filename = "image" extension = "jpg" return f"{relative_folder}/{filename}.{extension}"
I have added these extra lines.
if extension.lower() not in ["jpeg", "jpg", "png", "webp"]: filename = f"{filename}.{extension}" extension = ".jpg" (edited)