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

client.getListing not returning full info #1108

Open
rchrd2 opened this issue Dec 5, 2017 · 2 comments

Comments

2 participants
@rchrd2
Copy link

commented Dec 5, 2017

The documentation makes me expect a response that has more info than just true.
http://remotestoragejs.readthedocs.io/en/latest/js-api/base-client.html#list-of-functions

Am I doing something wrong, or is there a bug? This is "remotestoragejs@1.0.0",

client.getListing('') response:

{
    "test/": true,
    "demo.txt/": true,
    "apple.jpg": true,
    "styles/": true,
    "folder/": true,
    "views/": true,
    "js/": true
}

Actual API response

{
    "@context": "http://remotestorage.io/spec/folder-description",
    "items": {
        "test/": {
            "ETag": "857b527483cb0ee9fbe96c32523be949"
        },
        "demo.txt/": {
            "ETag": "65a42c26f75722109bad85246a15414a"
        },
        "apple.jpg": {
            "ETag": "98db258db75446f0aeebe10f761b97ff",
            "Content-Length": 4160,
            "Content-Type": "image/jpeg; charset=binary"
        },
        "styles/": {
            "ETag": "50e05011997701256c2e92fdbcbc209f"
        },
        "folder/": {
            "ETag": "a4391a6a61779554cd9af63145f72be6"
        },
        "views/": {
            "ETag": "1b30bdd77bff1373ce6665efd710d30c"
        },
        "js/": {
            "ETag": "635b3ed9a2f12b03b2ed71c21bc7497f"
        }
    }
}

Update:

The problem goes away when I disable local cache (IndexDB in my case)

new RemoteStorage({
  'cache': false,
});
@skddc

This comment has been minimized.

Copy link
Member

commented Dec 5, 2017

The documentation you linked also shows true as only value for directory items. However, you're right about the objects, and the documentation is completely missing that information!

The story is that the cached data format hasn't been adapted yet, after the RS protocol changed the data available in listings a while back. It's a rather invasive change, and we both wanted to wait until the old protocol version was outdated enough (which is now the case), as well as refactor the caching and sync code first (which is currently in progress). Here's the original issue about it, incl. more information in the comment history: #721 (TL;DR: metadata is only stored on item nodes in cache, but getListing does a single request to the directory node)

I think it's high time we tackled this. Let's put it on the agenda for 1.1.0! Any takers, please self-assign the issue, or announce your working on it as a comment here. Thanks.

(Btw, you can upgrade rs.js to 1.0.2 already.)

skddc added a commit that referenced this issue Dec 5, 2017

@skddc

This comment has been minimized.

Copy link
Member

commented Dec 5, 2017

The docs now contain a warning about this: https://remotestoragejs.readthedocs.io/en/latest/js-api/base-client.html#getListing

Thanks for bringing it up, @rchrd2!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.