Skip to content

Add sharepoint domain skill: authenticated file downloads - #586

Closed
tcwarburton wants to merge 1 commit into
browser-use:mainfrom
tcwarburton:sharepoint-download-skill
Closed

Add sharepoint domain skill: authenticated file downloads#586
tcwarburton wants to merge 1 commit into
browser-use:mainfrom
tcwarburton:sharepoint-download-skill

Conversation

@tcwarburton

@tcwarburton tcwarburton commented Aug 6, 2026

Copy link
Copy Markdown

Field-tested pattern for pulling real file bytes out of SharePoint/OneDrive document libraries: open a tab on the tenant origin, page-context fetch with credentials, base64 back through js(). Documents the traps (http_get has no cookies; Graph/ms365 MCP read_resource returns extracted text, never bytes; personal OneDrive is a separate origin).

🤖 Generated with Claude Code


Summary by cubic

Adds a SharePoint/OneDrive domain skill for authenticated file downloads. Documents a tested way to fetch real binary bytes from document libraries using an in-page, cookie-carrying request.

  • New Features
    • Guide added at domain-skills/sharepoint/download.md with a step-by-step snippet: open the tenant tab, fetch(..., { credentials: 'include' }), marshal via js(), decode to bytes.
    • Covers quoting URLs with spaces, verifying magic bytes, and handling multi‑MB files.
    • Notes personal OneDrive’s separate origin (<tenant>-my.sharepoint.com) and pitfalls: http_get() has no cookies; Graph/ms365 MCP read_resource returns extracted text, not bytes.

Written for commit dc508b8. Summary will update on new commits.

Review in cubic

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@browser-harness-review

Copy link
Copy Markdown

✅ Skill review passed

Reviewed 1 file(s) — no findings.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="domain-skills/sharepoint/download.md">

<violation number="1" location="domain-skills/sharepoint/download.md:26">
P2: The documented error path is broken: when the fetch returns a non-OK status the JS yields `'ERR:'+r.status`, which is then passed straight into `base64.b64decode(...)`, raising a cryptic `binascii.Error` instead of surfacing the status. Guard the decode result for the `ERR:` prefix (and check it's a str) before decoding so real HTTP failures are reported clearly.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

bin += String.fromCharCode.apply(null, bytes.subarray(i, i + 0x8000));
return btoa(bin);
})()""" % json.dumps(quote(url, safe=":/"))
data = base64.b64decode(js(code))

@cubic-dev-ai cubic-dev-ai Bot Aug 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The documented error path is broken: when the fetch returns a non-OK status the JS yields 'ERR:'+r.status, which is then passed straight into base64.b64decode(...), raising a cryptic binascii.Error instead of surfacing the status. Guard the decode result for the ERR: prefix (and check it's a str) before decoding so real HTTP failures are reported clearly.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At domain-skills/sharepoint/download.md, line 26:

<comment>The documented error path is broken: when the fetch returns a non-OK status the JS yields `'ERR:'+r.status`, which is then passed straight into `base64.b64decode(...)`, raising a cryptic `binascii.Error` instead of surfacing the status. Guard the decode result for the `ERR:` prefix (and check it's a str) before decoding so real HTTP failures are reported clearly.</comment>

<file context>
@@ -0,0 +1,37 @@
+    bin += String.fromCharCode.apply(null, bytes.subarray(i, i + 0x8000));
+  return btoa(bin);
+})()""" % json.dumps(quote(url, safe=":/"))
+data = base64.b64decode(js(code))
+```
+
</file context>
Fix with cubic

@tcwarburton

Copy link
Copy Markdown
Author

Closing this one, no longer pursuing upstream contributions. Thanks for the reviews.

@tcwarburton
tcwarburton deleted the sharepoint-download-skill branch August 20, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant