CloudRail API - Onedrive无法下载路径

时间:2017-03-29 18:20:32

标签: cloudrail

在过去的几天里,过去使用空格的代码已经开始失败。我积极开发,所以我可能搞砸了,但我不这么认为。下面是一个简单的示例,其中5个文件位于Test目录中。只有具有空格的文件无法下载。如果我去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);
            });
        }
    });
});
Making service: "onedrive"
Trying to download FILE: /Pictures/Test/dogs out.jpg
Trying to download FILE: /Pictures/Test/dogsout.jpg
Trying to download FILE: /Pictures/Test/IMAG0039.JPG
Trying to download FILE: /Pictures/Test/IMG_2494.JPG
Trying to download FILE: /Pictures/Test/whiskey_black.png
Unhandled rejection Error: Item does not exist FILE: /Pictures/Test/dogs out.jpg

Hello Charlie Becker
Downloaded FILE: /Pictures/Test/whiskey_black.png
Downloaded FILE: /Pictures/Test/IMG_2494.JPG
Downloaded FILE: /Pictures/Test/IMAG0039.JPG
Downloaded FILE: /Pictures/Test/dogsout.jpg

1 个答案:

答案 0 :(得分:0)

显然,微软在没有事先通知的情况下改变了他们接受的OneDrive API中带有空格的文件名所采用的URL编码方式。 最新版本的CloudRail Node.js SDK(2.17.3)已相应调整并应解决此问题。