OSC / bc_js_filepicker

A file picker for Batch Connect applications
MIT License
2 stars 6 forks source link

Update File Picker to use new Files API #144

Closed msquee closed 3 years ago

msquee commented 3 years ago

Closes #142

johrstrom commented 3 years ago

I wonder if just following the redirect works? that'd help with backward compatibility.

msquee commented 3 years ago

We can do that, but I think updating the API link is the better move because if we follow redirects then all HTTP requests will be 1+1. We should move the File Picker into the Dashboard once we finalize the plan for the JS upgrades in the Dashboard.

To follow redirects:

return fetch(pathmod.resolve(fs_api_root, path.replace(/(^\/)/, '')), {
  credentials: 'same-origin',
  redirect: 'follow',
});
GloktarFR commented 3 years ago

Hello,

I've been using the master branch of the js_filepicker with the master branch of ondemand. But I'm still getting a parsing error very similar to this one.

Though, the nginx log shows a different message I think:

ERROR "No such file or directory @ rb_file_s_stat - /https:/ao-ood2/pun/sys/dashboard/files/fs/home/toto"
INFO "method=GET path=/pun/sys/dashboard/files/api/v1/fs/https:/ao-ood2/pun/sys/dashboard/files/fs/home/toto format=html controller=FilesController action=fs status=200 duration=49.26 view=28.12"

I've been trying to force the path replacing the 'fetch' like this:

  return fetch('/pun/sys/files/api/v1/fs/home/toto', {
    credentials: 'same-origin',
    redirect: 'follow',
  });

Although I no longer see any error in the nginx log, I'm still getting the parsing error anyway.

INFO "method=GET path=/pun/sys/dashboard/files/api/v1/fs/home/toto format=html controller=FilesController action=fs status=200 duration=39.15 view=19.50"
johrstrom commented 3 years ago

Thanks! I opened another ticket - #150. I think @msquee may have identified this or similar. In any case thanks for the very good info in the comment!