Skip to content

Commit 7ba1f97

Browse files
SidUclaude
andcommitted
msteams: fix User-Agent gaps from review feedback
- Add User-Agent header to SharePoint fetchImpl callback (was the only remaining outbound Graph call without it) - Guard CloudAdapter User-Agent injection so caller-supplied headers are not clobbered by propagation.override() Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 8f55375 commit 7ba1f97

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

extensions/msteams/src/attachments/graph.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ export async function downloadMSTeamsGraphMedia(params: {
282282
fetchImpl: async (input, init) => {
283283
const requestUrl = resolveRequestUrl(input);
284284
const headers = new Headers(init?.headers);
285+
headers.set("User-Agent", buildUserAgent());
285286
headers.set("Authorization", `Bearer ${accessToken}`);
286287
return await safeFetch({
287288
url: requestUrl,

extensions/msteams/src/sdk.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ export function createMSTeamsAdapter(
3737
) {
3838
const [serviceUrl, scope, identity, headers] = args;
3939
const propagation = headers ?? new HeaderPropagation({});
40-
propagation.override({ "User-Agent": buildUserAgent() });
40+
if (!propagation.get("User-Agent")) {
41+
propagation.override({ "User-Agent": buildUserAgent() });
42+
}
4143
return super.createConnectorClient(serviceUrl, scope, identity, propagation);
4244
}
4345

@@ -46,7 +48,9 @@ export function createMSTeamsAdapter(
4648
) {
4749
const [identity, activity, headers] = args;
4850
const propagation = headers ?? new HeaderPropagation({});
49-
propagation.override({ "User-Agent": buildUserAgent() });
51+
if (!propagation.get("User-Agent")) {
52+
propagation.override({ "User-Agent": buildUserAgent() });
53+
}
5054
return super.createConnectorClientWithIdentity(identity, activity, propagation);
5155
}
5256
}

0 commit comments

Comments
 (0)