Skip to content

Commit

Permalink
fix(bulk): broken gdrive type detection (#744)
Browse files Browse the repository at this point in the history
  • Loading branch information
rofe authored May 24, 2024
1 parent f1f837a commit 545d114
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/extension/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ import sampleRUM from './rum.js';
return [...document.querySelectorAll('#drive_main_page [role="row"][aria-selected="true"]')]
// extract file name and type
.map((row) => {
const typeHint = (row.querySelector(':scope div[role="gridcell"] > div:nth-child(2) > div > div[data-tooltip]') // list layout
const typeHint = (row.querySelector(':scope div[role="gridcell"] > div:nth-child(2) > div:nth-child(1)') // list layout
|| row.querySelector(':scope div[role="gridcell"]'))?.getAttribute('aria-label'); // grid layout
let type = 'unknown';
if (typeHint) {
Expand Down
28 changes: 7 additions & 21 deletions test/fixtures/admin-gdrive.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
<div>
</div>
<div>
<div>
<div data-tooltip="Google Drive Folder: folder" aria-label="Google Drive Folder: folder">folder</div>
</div>
<div data-tooltip="Google Drive Folder: folder" aria-label="folder Shared Google Drive Folder">folder</div>
</div>
</div>
</div>
Expand All @@ -20,9 +18,7 @@
<div>
</div>
<div>
<div>
<div data-tooltip="PDF: file.pdf" aria-label="PDF: file.pdf">file.pdf</div>
</div>
<div data-tooltip="PDF: file.pdf" aria-label="file.pdf Shared PDF">file.pdf</div>
</div>
</div>
</div>
Expand All @@ -31,9 +27,7 @@
<div>
</div>
<div>
<div>
<div data-tooltip="Google Docs: document" aria-label="Google Docs: document">document</div>
</div>
<div data-tooltip="Google Docs: document" aria-label="document Shared Google Docs">document</div>
</div>
</div>
</div>
Expand All @@ -42,9 +36,7 @@
<div>
</div>
<div>
<div>
<div data-tooltip="Google Sheets: spreadsheet" aria-label="Google Sheets: spreadsheet">spreadsheet</div>
</div>
<div data-tooltip="Google Sheets: spreadsheet" aria-label="spreadsheet Shared Google Sheets">spreadsheet</div>
</div>
</div>
</div>
Expand All @@ -53,9 +45,7 @@
<div>
</div>
<div>
<div>
<div data-tooltip="Word: document.docx" aria-label="Word: document.docx">document.docx</div>
</div>
<div data-tooltip="Word: document.docx" aria-label="document.docx Shared Word">document.docx</div>
</div>
</div>
</div>
Expand All @@ -64,9 +54,7 @@
<div>
</div>
<div>
<div>
<div data-tooltip="Excel: spreadsheet.xlsx" aria-label="Excel: spreadsheet.xlsx">spreadsheet.xlsx</div>
</div>
<div data-tooltip="Excel: spreadsheet.xlsx" aria-label="spreadsheet.xlsx Shared Excel">spreadsheet.xlsx</div>
</div>
</div>
</div>
Expand All @@ -75,9 +63,7 @@
<div>
</div>
<div>
<div>
<div data-tooltip="Google Docs: foo/../bar" aria-label="Google Docs: foo/../bar">foo/../bar</div>
</div>
<div data-tooltip="Google Docs: foo/../bar" aria-label="foo/../bar Shared Google Docs">foo/../bar</div>
</div>
</div>
</div>
Expand Down

0 comments on commit 545d114

Please sign in to comment.