上传aws cli文件时S3键中不需要的额外字符(Unwanted extra characters in S3 Key while uploading files for aws cli)

编程入门 行业动态 更新时间:2024-10-03 23:24:37
上传aws cli文件时S3键中不需要的额外字符(Unwanted extra characters in S3 Key while uploading files for aws cli)

我有我的下面的shell脚本,我正在使用它将文件上传到我的s3存储桶。

#!/bin/sh export AWS_ACCESS_KEY_ID="$KEY_ID" export AWS_SECRET_ACCESS_KEY="$KEY_SECRET" echo "[INFO] AWS_ACCESS_KEY_ID - $AWS_ACCESS_KEY_ID" echo "[INFO] AWS_SECRET_ACCESS_KEY - $AWS_SECRET_ACCESS_KEY" S3_URL="s3://mybucket/uploads" aws s3 cp ../data.pdf $S3_URL/data.pdf aws s3 cp ../data.html.zip $S3_URL/data.html.zip echo "[INFO] Uploaded Successfully" echo ""

当我运行这个脚本时,这些文件被上传到S3存储桶。 但是,我在密钥名称的末尾看到了一些额外的字符。

以下是我的S3浏览器UI的屏幕截图,

有人可以告诉我为什么这些角色自动出现,当时我没有打算让他们来。

我怎样才能摆脱这些?

此外,这是为我的下载服务创建问题,无法读取这些文件并获取密钥未找到错误。

I have my following shell script which I am using to upload files to my s3 bucket.

#!/bin/sh export AWS_ACCESS_KEY_ID="$KEY_ID" export AWS_SECRET_ACCESS_KEY="$KEY_SECRET" echo "[INFO] AWS_ACCESS_KEY_ID - $AWS_ACCESS_KEY_ID" echo "[INFO] AWS_SECRET_ACCESS_KEY - $AWS_SECRET_ACCESS_KEY" S3_URL="s3://mybucket/uploads" aws s3 cp ../data.pdf $S3_URL/data.pdf aws s3 cp ../data.html.zip $S3_URL/data.html.zip echo "[INFO] Uploaded Successfully" echo ""

When I run this script, the files get uploaded to S3 bucket. However, I see some extra characters at the end of the key name.

Here is the screenshot from my S3 browser UI,

Can somebody tell me why these characters are coming up automatically, when I didnt intend them to come.

How can I get rid of these?

Also, this is creating issues for my download service which is not able to read these files and gets Key not found error.

最满意答案

看起来你在脚本中插入了一些不可见的UTF-8代码。

请参阅: Wordpress将%E2%80%8E放在我的网址末尾,怎么样?

另请参阅网页搜索: https : //www.google.com.au/search?q=%25e2%2580%258b

确保你使用的是真正的文本编辑器(不像MS Word)。 应该有像Zap Gremlins命令那样的可以删除不好的字符的东西。

或者,只需删除并重新输入(不要复制/粘贴)其中的aws s3 cp行。

It appears that you have some invisible UTF-8 code inserted in your script.

See: Wordpress putting %E2%80%8E at the end of my url, howcome?

Also, see web search: https://www.google.com.au/search?q=%25e2%2580%258b

Make sure that you are using a real text editor (not something like MS Word). There should be something like a Zap Gremlins command that can remove bad characters.

Or, just delete and re-type (don't copy/paste) the lines with aws s3 cp in them.

更多推荐

本文发布于:2023-08-04 19:52:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1422265.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中不   字符   上传   文件   cli

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!