Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sliceUploadFile 方法上传文件以后,静态网站不能访问 #24

Closed
sdlzhd opened this issue Aug 28, 2017 · 5 comments
Closed

sliceUploadFile 方法上传文件以后,静态网站不能访问 #24

sdlzhd opened this issue Aug 28, 2017 · 5 comments

Comments

@sdlzhd
Copy link

sdlzhd commented Aug 28, 2017

代码如下:

uploadFileList.forEach((item)=>{
    cos.sliceUploadFile({
        Bucket: args.bucket,
        Region: args.region,
        Key: item.key,
        FilePath: item.filePath,
    }, (err, data)=>{
        if (err) {
            console.log(err);
        } else {
            console.log(data);
        }
    });
 });

其中,uploadFileList是一个数组,遍历出的item对象如下

{ 
    key: '/tags/PHP/index.html',
    filePath: '/home/dongdong/Documents/hexo/public/tags/PHP/index.html'
 }

假设静态托管的网址为http://exp.com
上传完成后,访问这个页面(http://exp.com/tags/PHP),会报unexpectedly closed the connection.
但是如果访问http://exp.com/tags/PHP/index.html,就正常,而且我如果手动上传这个文件,就不会出现这种情况,所有的访问都是正常的

@sdlzhd sdlzhd closed this as completed Aug 28, 2017
@sdlzhd sdlzhd reopened this Aug 28, 2017
@sdlzhd
Copy link
Author

sdlzhd commented Aug 28, 2017

我把上传方法替换成putObject之后,就可以正常使用了

@carsonxu
Copy link
Collaborator

ok,不知道你这里是不是权限问题?putObject 是不分片的上传,如果能满足也可以。

@sdlzhd
Copy link
Author

sdlzhd commented Aug 28, 2017 via email

@carsonxu
Copy link
Collaborator

Promise 可能不支持,我们后续先看看不支持 bluebird 是什么原因,感谢关注。

@sdlzhd
Copy link
Author

sdlzhd commented Aug 28, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants