dokieli icon indicating copy to clipboard operation
dokieli copied to clipboard

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

Open smalinin opened this issue 7 years ago • 7 comments

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

smalinin avatar Nov 06 '18 09:11 smalinin

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:

  • rewriteBaseURL: https://github.com/linkeddata/dokieli/blob/main/src/dokieli.js#L3578-L3612 or
  • setBaseURL: https://github.com/linkeddata/dokieli/blob/main/src/dokieli.js#L3614-L3641

csarven avatar Nov 06 '18 10:11 csarven

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

smalinin avatar Nov 07 '18 10:11 smalinin

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).

csarven avatar Nov 08 '18 10:11 csarven

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.

kidehen avatar Nov 08 '18 19:11 kidehen

@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.

csarven avatar Nov 08 '18 20:11 csarven

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

kidehen avatar Nov 08 '18 21:11 kidehen

@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.

csarven avatar Nov 11 '18 10:11 csarven