xinbinhuang edited a comment on issue #18111: URL: https://github.com/apache/airflow/issues/18111#issuecomment-936953895
> I want it to be able to upload a file in any case (file already exists or not), I know about the `replace` flag, but I also want to cover the case when the file doesn't exists. > > My suggestion is to catch the error and allow the upload, without adding another error. It will be something like, updating: > > ```python > except ClientError as e: > if e.response["ResponseMetadata"]["HTTPStatusCode"] == 404: > return False > else: > raise e > ``` > > to: > > ```python > except ClientError as e: > if e.response["ResponseMetadata"]["HTTPStatusCode"] IN (404, 403): > return False > else: > raise e > ``` > > shortest PR ever 😆 I will try to submit one next week. I believe the `replace=True` flag will just upload the file regardless if the key exists or not. We don't call the `check_for_key` function when `replace=True`. Have you tried it? IMO, It's not reasonable for us to swallow the permission error. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org