douna4762 2013-03-21 21:16
浏览 96

AWS PHP SDK第2版S3文件名编码问题

We've been using the AWS SDK with pretty good results for uploading/grabbing files, but we ran into a snag.

There is a file stored in S3 that looks like it was urlescaped. "/mefile/412501_413000/412604_-12%20C008%20Fil%20R[1].doc.gpg"

So far the SDK has managed to handle every mangled filename we've thrown at it. But when I try a "doesObjectExist" I also get a failure for that file.

$s3->doesObjectExist("mabucket","/mefile/412501_413000/412604_-12%20C008%20Fil%20R[1].doc.gpg")

will always fail. I've tried uploading that file from a local storage and that fails as well. I get a funky exceptions: "The request signature we calculated does not match the signature you provided. Check your key and signing method."

Is there any trick I need to encode the filename with before using the "doesObjectExist". It seems to handle all sorts of bad filenames already (spaces/utf-8 chars/& etc), so I'm confused why this doesn't work.

UPDATE: Upgrading to the latest AWS SDK for PHP 2.2.1. Was running on version 2.1.0 which apparently had several bugs. If you are on Ubuntu 10.04, this is a bit rough. (See comments about PHP version upgrades here: http://www.zalexblog.com/2011/01/07/installing-php-5-3-3-on-ubuntu-10-04/)

  • 写回答

3条回答 默认 最新

  • duanping1632 2013-03-21 21:20
    关注

    Can you try with html_entity_decode ?

    $s3->doesObjectExist("mabucket",html_entity_decode("/mefile/412501_413000/412604_-12%20C008%20Fil%20R[1].doc.gpg"))
    
    评论

报告相同问题?

悬赏问题

  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条