linkeddata / dokieli

:bulb: dokieli is a clientside editor for decentralised article publishing, annotations and social interactions
https://dokie.li/
Other
788 stars 81 forks source link

The document saved with SaveAs could not work properly in new place, if it has scripts/css/etc with relative source URLs #255

Open smalinin opened 5 years ago

smalinin commented 5 years ago

May be relative URLs must be converted to absolute URLs !?

csarven commented 5 years ago

Edit: Line numbers may have changed.

I'm not sure I understand exactly. The source document uses relative URLs and you've selected "Use reference as is" from the Save As dialog? Can you show me the document you're trying to save as?

This code block takes cares of that as far as I know: https://github.com/linkeddata/dokieli/blob/main/src/dokieli.js#L3479-L3487

but perhaps there is an issue in:

smalinin commented 5 years ago

Sorry, it looks, I did something wrong, I see that only the next HTML resources is not saved properly

 <link as="script" href="/yts/jsbin/desktop_polymer-vflWJu8nq/desktop_polymer.js" rel="preload" />  

The HREF for such resources isn't converted to absolute URL. (The example is from youtube service). If I use default SaveAs settings Location of media resources: Use references as is

csarven commented 5 years ago

At which URL is that code from?

Is that the actual code or is there a typo?

What can be copied is this selector: head link, [src], object[data]. Note that while that link[href] can be copied and URL updated, it is on link, and not script (as per JavaScript).

kidehen commented 5 years ago
screen shot 2018-11-08 at 2 40 45 pm

That's what's happening to me when attempt to make a review that should end up in my inbox. Note the 401 and issue with Link Header.

csarven commented 5 years ago

@kidehen Is that CloudStorage article the derived copy? What's the URL? I don't quite understand how what you've raised is related to this issue.

kidehen commented 5 years ago

Here a more specific example whereby I was already logged into dokie.li and my save attempt fails.

screen shot 2018-11-08 at 4 09 19 pm

Here a repeat after I log out and back in, which is more confusing due to the fact that save worked despite misleading 401.

screen shot 2018-11-08 at 4 13 52 pm

/cc @smalinin

csarven commented 5 years ago

@kidehen I think that ( https://github.com/linkeddata/dokieli/issues/255#issuecomment-437158351 ) issue may be related to token expiring (suspected at https://github.com/linkeddata/dokieli/issues/257#issuecomment-437655149 ).

Are you able to reproduce this where the destination you want to save to is under a private path? If so, the directory listing wouldn't show because you're no longer authenticated. So, we need to re-auth and make sure the UI reflects the actual state.

In any case, I don't think the issue you've raised here is related to the one that @smalinin brought up.