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

AsyncMirror and Dropbox fails when there are subfolders with file #276

Open
FredrikAleksander opened this issue Jul 31, 2019 · 4 comments
Open

Comments

@FredrikAleksander
Copy link

When using AsyncMirror and Dropbox, and there are subfolders with files, it fails during configure. In the error, it seems to try and fetch but uses the subfolder path twice errmsg
.

I'm running the latest code from the master branch

A simple way to reproduce this error is by using this code in a web page, waiting for it to write the changes, and reload the page.

var dbx = new Dropbox.Dropbox({ fetch, accessToken: 'REDACTED' });
BrowserFS.configure({
    fs: "AsyncMirror",
    options: {
        sync: { fs: "InMemory" },
        async: {
            fs: "Dropbox",
            options: {
                client: dbx
            }
        }
    }
}, function (err) {
    if (err) { console.log(err); return; }

    var fs = BrowserFS.BFSRequire('fs');
    if(!fs.existsSync('/subfolder')) {
    	fs.mkdirSync('/subfolder');
    	fs.writeFileSync('/subfolder/somefile.txt', 'hello world');
    }
});
@Faless
Copy link

Faless commented Mar 21, 2020

I can confirm this issue, after some debugging, it seems the reason for this is that Dropbox returns the absolute path of the file when listing directories.
The AsyncMirror instead, seems to expect each entry to be the relative path to the listed directory.

I'm pretty new to the codebase, so I'm not sure which behaviour is supposed to be correct (I tend to lean towards the AsyncMirror expectations). I'll dig further.

@Faless
Copy link

Faless commented Mar 21, 2020

(I tend to lean towards the AsyncMirror expectations).

Yep, official doc says

where files is an array of the names of the files in the directory excluding '.' and '..'.

so the correct behaviour is relative path. I'll look into a fix, hoping it does not break other Dropbox internals.

@dr-vortex
Copy link
Collaborator

@FredrikAleksander Does this bug still exist?

@dr-vortex
Copy link
Collaborator

Closing (stale). If you would like to reopen this issue, please do so by creating a new issue in the relevant repositories of @browser-fs

@dr-vortex dr-vortex closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2023
Repository owner locked and limited conversation to collaborators Oct 25, 2023
@dr-vortex dr-vortex reopened this May 17, 2024
Repository owner unlocked this conversation May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants