Skip to content

feat(graph): expose @microsoft.graph.downloadUrl and /content on driveItems - #3248

Draft
dschmidt wants to merge 2 commits into
chore/bump-libre-graph-api-gofrom
feat/graph-driveitem-download-url
Draft

feat(graph): expose @microsoft.graph.downloadUrl and /content on driveItems#3248
dschmidt wants to merge 2 commits into
chore/bump-libre-graph-api-gofrom
feat/graph-driveitem-download-url

Conversation

@dschmidt

@dschmidt dschmidt commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Populates @microsoft.graph.downloadUrl on file driveItems and implements the v1beta1 GET .../items/{item-id}/content redirect (302), both pointing at the same signed, short-lived by-id WebDAV URL (verified by the proxy, no auth header). The signer lives on BaseGraphService so the driveItem conversion can build the URL.

@microsoft.graph.downloadUrl is opt-in via $select (facets are always returned, only this relationship is selected), following the thumbnails $select pattern from #3210. $select supports multiple comma-separated values.

The URL is signed with the same OC_URL_SIGNING_SECRET the proxy verifies, with a 30 minute TTL.

Stacked on #3246 (needs the libre-graph-api-go bump for the @microsoft.graph.downloadUrl field).

This PR also integrates the BaseGraphService.publicBaseURL refactor from #2770 as its first commit (the download URL builds on the same pre-parsed base URL), so #2770 is superseded by this PR.

@codacy-production

codacy-production Bot commented Aug 5, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 26 complexity · -2 duplication

Metric Results
Complexity 26
Duplication -2

View in Codacy

🟢 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

View coverage diff in Codacy

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
dschmidt force-pushed the feat/graph-driveitem-download-url branch 4 times, most recently from a34afba to 787b304 Compare August 5, 2026 14:24
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant