Code Monkey home page Code Monkey logo

Comments (5)

burmecia avatar burmecia commented on June 21, 2024

Can you share your code? I've tested on Windows 10 but cannot reproduce this issue.

from zbox.

anlumo avatar anlumo commented on June 21, 2024

Here's a demo application: https://github.com/anlumo/zboxurls

Here's the output on my machine:

D:\zboxurls> cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.15s
     Running `target\debug\zboxurls.exe`
Opening URL: file:///D:/zboxurls/target/debug/test-fs
thread 'main' panicked at 'opening archive failed: Io(Os { code: 123, kind: Other, message: "The filename, directory name, or volume label syntax is incorrect." })', src\libcore\result.rs:1189:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: process didn't exit successfully: `target\debug\zboxurls.exe` (exit code: 101)

from zbox.

burmecia avatar burmecia commented on June 21, 2024

Thanks @anlumo . The reason is that url generated by Url::from_file_path is not compatible with ZboxFS URI format, which requires an OS path after file://.

For example, the required URI is like: file://C:/Users/foo bar/dir, but the URI generated by Url::from_file_path is like: file:///C:/Users/foo%20bar/dir.

A quick solution might be converting the url back to path using url.to_file_path.

let url = Url::from_file_path(&path).unwrap();
RepoOpener::new()
        .create_new(true)
        .open(&format!("file://{}", url.to_file_path().unwrap().display()), "abcdef")
        .expect("opening archive failed");

from zbox.

anlumo avatar anlumo commented on June 21, 2024

According to Wikipedia, this is not correct. It explicitly states that the third slash is required there.

However, I noticed that your API accepts file://D:\zboxurls\target\debug\test-fs as the URL, which is horrible, but at least I can get it to work now…

from zbox.

burmecia avatar burmecia commented on June 21, 2024

The URI used in ZboxFS is not same as the standard URI or URL, it is different according to different storage. For file storage, it looks like an URL but actually not, it is just an identifier points to a path on OS. Anyway, I will update the doc to make it more clear.

from zbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.