solid-contrib/solid-crud-tests

the create- tests are leaving dirs which should have been deleted

Closed this issue · 6 comments

the create- tests are leaving dirs which should have been deleted

Yep, the problem does lie with the directory listings. The code I'm bumping into is this (in helpers/util.ts):

function isContainer(url) {
  return (url.substr(-1) === '/');
}

My directory listing is returning

contains <exists.ttl> <new>

notice that 'new' does not have a trailing slash. In the definition of further in the turtle document, it is specified as a BasicContainer and Container.

If I add a trailing slash after 'new', the recursive delete works as expected, but I'm not convinced that we should require a slash for that. Thoughts?

hm, interesting thought! Would it be much work to add that slash?

Certainly not - adding the slash is trivial, but shouldn't the test recurse into all the resources that are a Container instead of just the resources that end with a slash?

Good question. It hadn't occurred to me to leave out the trailing slash. I know some people who could discuss for days about the meaning of slashes in URLs :)

The spec does say that [p]aths ending with a slash
denote a container resource
.

Ok, fixes this on the other side by adding a trailing slash to the directory path. no change needed here, the dirs are now correctly removed.