feat(graph): expose @microsoft.graph.downloadUrl and /content on driveItems - #3248
Draft
dschmidt wants to merge 2 commits into
Draft
feat(graph): expose @microsoft.graph.downloadUrl and /content on driveItems#3248dschmidt wants to merge 2 commits into
dschmidt wants to merge 2 commits into
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 26 |
| Duplication | -2 |
🟢 Coverage 61.67% diff coverage · +0.07% coverage variation
Metric Results Coverage variation ✅ +0.07% coverage variation (-1.00%) Diff coverage ✅ 61.67% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (0fb3439) 84007 19240 22.90% Head commit (0844883) 84087 (+80) 19318 (+78) 22.97% (+0.07%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#3248) 120 74 61.67% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
dschmidt
force-pushed
the
feat/graph-driveitem-download-url
branch
4 times, most recently
from
August 5, 2026 14:24
a34afba to
787b304
Compare
drive.WebUrl, driveItem.WebUrl and the public share link WebUrl all derive from the same config value (graph.spaces.webdav_base), but only driveItem.WebUrl used the pre-parsed BaseGraphService.publicBaseURL. The other two re-parsed the config on every call. Add a webURLForResource method on BaseGraphService for the /f/<id> URLs (used twice, with a *string return matching the libregraph DriveItem field shape), and inline g.publicBaseURL for the single /s/<token> share-link case. Convert cs3ResourceToDriveItem and formatDriveItems from free functions into BaseGraphService methods so they pick up logger and publicBaseURL from the receiver. This also aligns them with the surrounding code: BaseGraphService already exposes ~15 similar methods, so the two free functions were the odd ones out. Net: all three WebUrls are now constructed from a single pre-parsed URL, and the (g.logger, g.publicBaseURL) plumbing at 7 call sites disappears.
…eItems
Add a signed, by-id WebDAV download URL for driveItems:
- GET .../items/{item-id}/content redirects (302) to the signed URL
- @microsoft.graph.downloadUrl is added to file driveItems when
requested via $select (facets are always returned, only this
relationship is opt-in), matching the thumbnails $select pattern
The URL is signed with the same OC_URL_SIGNING_SECRET the proxy
verifies, with a 30 minute TTL.
dschmidt
force-pushed
the
feat/graph-driveitem-download-url
branch
from
August 5, 2026 22:51
787b304 to
0844883
Compare
2 tasks
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.
Populates
@microsoft.graph.downloadUrlon file driveItems and implements the v1beta1GET .../items/{item-id}/contentredirect (302), both pointing at the same signed, short-lived by-id WebDAV URL (verified by the proxy, no auth header). The signer lives onBaseGraphServiceso the driveItem conversion can build the URL.@microsoft.graph.downloadUrlis opt-in via$select(facets are always returned, only this relationship is selected), following the thumbnails$selectpattern from #3210.$selectsupports multiple comma-separated values.The URL is signed with the same
OC_URL_SIGNING_SECRETthe proxy verifies, with a 30 minute TTL.Stacked on #3246 (needs the libre-graph-api-go bump for the
@microsoft.graph.downloadUrlfield).This PR also integrates the
BaseGraphService.publicBaseURLrefactor from #2770 as its first commit (the download URL builds on the same pre-parsed base URL), so #2770 is superseded by this PR.