Skip to content

Create directory on system without decoding encoded values in Slug  #422

Closed

Description

@csarven

Perhaps the title can be better with less assumptions as to what may be happening. Here is the code that I've used:

var options = {};
var url = 'https://example.org/';
var contentType = 'text/turtle';
var links = '<http://www.w3.org/ns/ldp#Container>; rel="type"';
var slug = encodeURIComponent('http://csarven.ca/foo');
var data = '';

var http = new XMLHttpRequest();
http.open('POST', url);
http.setRequestHeader('Content-Type', contentType);
http.setRequestHeader('Link', links);
if (slug && slug.length > 0) {
    http.setRequestHeader('Slug', slug);
}
if (!options.noCredentials) {
    http.withCredentials = true;
}
http.onreadystatechange = function() {
    if (this.readyState == this.DONE) {
        console.log(this);
    }
};
http.send(data);

Response has Location: /http%3A%2F%2Fcsarven.ca%2Ffoo.

What's physically created on the system is directory http: with subdirectory csarven.ca with file foo

Expected directory: http%3A%2F%2Fcsarven.ca%2Ffoo

This should be analogous to mkdir "http%3A%2F%2Fcsarven.ca%2Ffoo"

Activity

  1. csarven commented on Jul 29, 2016

    @csarven
    MemberAuthor

    Oh there is more:

    If I mkdir http%3A%2F%2Fcsarven.ca%2Ffoo and then later POST to that directory, the POST goes through (i.e., it creates say resource https://example.org/http%3A%2F%2Fcsarven.ca%2Ffoo/bar). However, when I GET that container (http://example.org/http%3A%2F%2Fcsarven.ca%2Ffoo), it has ldp:contains <http://example.org/bar>. Expected: ldp:contains <http://example.org/http%3A%2F%2Fcsarven.ca%2Ffoo/bar>

  2. dmitrizagidulin commented on Jul 29, 2016

    @dmitrizagidulin
    Contributor

    Thanks, Sarven, that's helpful.

  3. dmitrizagidulin commented on Dec 7, 2016

    @dmitrizagidulin
    Contributor

    Fixed in PR #469, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions