adobe / helix-sidekick-extension

Browser extension for authors on AEM projects
Apache License 2.0
21 stars 36 forks source link

GDrive: Cannot preview spreadsheet from list view and grid view #743

Closed cpiosecny closed 2 months ago

cpiosecny commented 2 months ago

Description The changes in #725 seem to be insufficient for detecting the correct file type and thus the URL generated for the preview POST is wrong.

To Reproduce Steps to reproduce the behavior:

  1. Go to a folder in gdrive
  2. Create a new spreadsheet and save it
  3. Go to your file list and try to preview the spreadsheet
  4. See error image the extension POSTs to https://admin.hlx.page/preview/<owner>/<repo>/main/<spreadsheet name> which is lacking the json extension due to the type detection not working (type is detected as unknown)

Root cause Using hardcoded string detection for data-tooltip and aria-label does not work when using a non-English locale.

Expected behavior Previewing from the folder view POSTs to https://admin.hlx.page/preview/<owner>/<repo>/main/<spreadsheet name>.json

rofe commented 2 months ago

@cpiosecny thanks for reporting and debugging! A fix is being published (v6.45.1)

trieloff commented 2 months ago

:tada: This issue has been resolved in version 6.45.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

cpiosecny commented 2 months ago

Hey @rofe , thanks for the quick response but unfortunately this does not fix the underlying issue. Relevant DOM for spreadsheet named bug with German Locale:

<div class="uXB7xe" jsaction=" mousedown:TiSivd;" aria-label="bug Freigegebene Google Tabellen-Datei">
    <div class="KL4NAf" data-tooltip="Google Tabellen: bug" aria-label="Google Tabellen: bug"
         data-tooltip-align="b,c" data-tooltip-delay="500" data-tooltip-unhoverable="true">bug
    </div>
</div>

I do not see how to match this properly across Locales without getting all translated Labels and matching against them :<

rofe commented 2 months ago

@cpiosecny the underlying problem here was language independent, it was due to yet another change Google made to the DOM structure. You are absolutely right that the current solution does not work very well with other languages (to be exact, this has been a concern since the last time we had to change the type detection due to another change in the gdrive DOM) , but to me, that's a different issue.

rofe commented 2 months ago

I will think of a solution for non-English languages.