0

在过去的几天里,过去使用空格的代码开始出现故障。我正在积极开发,所以可能我把事情搞砸了,但我不这么认为。下面是一个简单的示例,其中 5 个文件位于测试目录中。只有带空格的文件下载失败。如果我转到 OneDrive 并将其重命名为无空格,那么我的 CloudRail 应用程序将继续运行而不会出现错误。

感谢您的任何帮助,您可以提供!

查理·贝克尔


app.get("/auth/test/onedrive", (req, res) => {
    let service = makeService('onedrive'); // Make the service the user is logged in with
    service.loadAsString(authState); // Skip authentication by loading the saved credentials
    service.getUserName((err, name) => { // We retrieve the user's full name and save it on signup so it stays constant
        console.log('Hello ' + name);
    });

    service.getChildren("/Pictures/Test", (err, children) => {
        if (err) throw err;
        for (let child of children) {
            console.log('Trying to download FILE: ' + child.path);

            service.download(child.path, (err, stream) => {
                if (err) throw err + ' FILE: ' + child.path;

                console.log('Downloaded FILE: ' + child.path);
            });
        }
    });
});
制作服务:“onedrive”
尝试下载文件:/Pictures/Test/dogs out.jpg
尝试下载文件:/Pictures/Test/dogsout.jpg
尝试下载文件:/Pictures/Test/IMAG0039.JPG
尝试下载文件:/Pictures/Test/IMG_2494.JPG
尝试下载文件:/Pictures/Test/whiskey_black.png
未处理的拒绝错误:项目不存在文件:/Pictures/Test/dogs out.jpg

你好查理贝克尔
下载文件:/Pictures/Test/whiskey_black.png
下载文件:/Pictures/Test/IMG_2494.JPG
下载文件:/Pictures/Test/IMAG0039.JPG
下载文件:/Pictures/Test/dogsout.jpg
4

1 回答 1

0

显然,微软在没有事先声明的情况下改变了他们接受 OneDrive API 中带有空格的文件名的 URL 编码类型。CloudRail Node.js SDK (2.17.3) 的最新版本已进行了相应调整,应该可以解决此问题。

于 2017-04-03T14:13:03.843 回答