Add sharepoint domain skill: authenticated file downloads - #586
Closed
tcwarburton wants to merge 1 commit into
Closed
Add sharepoint domain skill: authenticated file downloads#586tcwarburton wants to merge 1 commit into
tcwarburton wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Skill review passedReviewed 1 file(s) — no findings. |
Contributor
There was a problem hiding this comment.
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)) |
Contributor
There was a problem hiding this comment.
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>
Author
|
Closing this one, no longer pursuing upstream contributions. Thanks for the reviews. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
domain-skills/sharepoint/download.mdwith a step-by-step snippet: open the tenant tab,fetch(..., { credentials: 'include' }), marshal viajs(), decode to bytes.<tenant>-my.sharepoint.com) and pitfalls:http_get()has no cookies; Graph/ms365 MCPread_resourcereturns extracted text, not bytes.Written for commit dc508b8. Summary will update on new commits.