jvilk / BrowserFS

BrowserFS is an in-browser filesystem that emulates the Node JS filesystem API and supports storing and retrieving files from various backends.
Other
3.06k stars 215 forks source link

BrowserFS.configure never report error for IsoFS in BrowserFS v1.x #251

Closed 1koval closed 8 months ago

1koval commented 5 years ago

https://github.com/jvilk/BrowserFS/blob/8ed7c19ab12896b7479527f5570975f2ca3349bf/src/backend/IsoFS.ts#L1176

    } catch (e) {
      e = e;
    }

e = e typo leads to lost error code (error never reported to a caller).

To reproduce:

var BrowserFS = require("browserfs");
var Buffer = BrowserFS.BFSRequire('buffer').Buffer;

// Workaround for https://github.com/jvilk/BrowserFS/issues/250
var size = 18 * 2048;
var broken_iso = Array(size);
for (var i=0;i<size;i++) {
    broken_iso[i]= 255; // VolumeDescriptorSetTerminator
}

var mountConfig = {
    fs: "MountableFileSystem",
    options: {
        "/iso": {
            fs: "IsoFS",
            options: {
                data: Buffer.from(broken_iso),
                name: 'name'
            }
        }
    }
};
BrowserFS.configure(mountConfig, function (e) {
    if (e) {
        console.log('never');
   }
   console.log('always');
});
console.log('always');

Potential fix:

    } catch (ex) {
      e = ex;
    }

More advanced fixes already in 2.x branch.

If would be nice to resolve it in production 1.x release.

james-pre commented 8 months ago

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