Skip to content

Commit 92b5cd0

Browse files
authored
Refined user-agent value to avoid failure when os information is not available on some platforms. (Azure#20095)
1 parent 5d81b1d commit 92b5cd0

File tree

8 files changed

+24
-4
lines changed

8 files changed

+24
-4
lines changed

sdk/storage/storage-blob/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
### Bugs Fixed
1010

11+
- Refined user-agent value to avoid failure when os information is not available on some platforms.
12+
1113
### Other Changes
1214

1315
## 12.10.0-beta.1 (2022-04-19)

sdk/storage/storage-blob/src/TelemetryPolicyFactory.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ export class TelemetryPolicyFactory implements RequestPolicyFactory {
4444
}
4545

4646
// e.g. (NODE-VERSION 4.9.1; Windows_NT 10.0.16299)
47-
const runtimeInfo = `(NODE-VERSION ${process.version}; ${os.type()} ${os.release()})`;
47+
let runtimeInfo = `(NODE-VERSION ${process.version})`;
48+
if (os) {
49+
runtimeInfo = `(NODE-VERSION ${process.version}; ${os.type()} ${os.release()})`;
50+
}
4851
if (userAgentInfo.indexOf(runtimeInfo) === -1) {
4952
userAgentInfo.push(runtimeInfo);
5053
}

sdk/storage/storage-file-datalake/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
### Bugs Fixed
1010

11+
- Refined user-agent value to avoid failure when os information is not available on some platforms.
12+
1113
### Other Changes
1214

1315
## 12.9.0-beta.1 (2022-04-19)

sdk/storage/storage-file-datalake/src/TelemetryPolicyFactory.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ export class TelemetryPolicyFactory implements RequestPolicyFactory {
4444
}
4545

4646
// e.g. (NODE-VERSION 4.9.1; Windows_NT 10.0.16299)
47-
const runtimeInfo = `(NODE-VERSION ${process.version}; ${os.type()} ${os.release()})`;
47+
let runtimeInfo = `(NODE-VERSION ${process.version})`;
48+
if (os) {
49+
runtimeInfo = `(NODE-VERSION ${process.version}; ${os.type()} ${os.release()})`;
50+
}
4851
if (userAgentInfo.indexOf(runtimeInfo) === -1) {
4952
userAgentInfo.push(runtimeInfo);
5053
}

sdk/storage/storage-file-share/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
### Bugs Fixed
1010

11+
- Refined user-agent value to avoid failure when os information is not available on some platforms.
12+
1113
### Other Changes
1214

1315
## 12.10.0-beta.1 (2022-04-19)

sdk/storage/storage-file-share/src/TelemetryPolicyFactory.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ export class TelemetryPolicyFactory implements RequestPolicyFactory {
4444
}
4545

4646
// e.g. (NODE-VERSION 4.9.1; Windows_NT 10.0.16299)
47-
const runtimeInfo = `(NODE-VERSION ${process.version}; ${os.type()} ${os.release()})`;
47+
let runtimeInfo = `(NODE-VERSION ${process.version})`;
48+
if (os) {
49+
runtimeInfo = `(NODE-VERSION ${process.version}; ${os.type()} ${os.release()})`;
50+
}
4851
if (userAgentInfo.indexOf(runtimeInfo) === -1) {
4952
userAgentInfo.push(runtimeInfo);
5053
}

sdk/storage/storage-queue/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
### Bugs Fixed
1010

1111
- Add `react-native` mapping to ESM entry point
12+
- Fixed a bug where customized `ProxyOptions` is overwrited by a default one when initializing `QueueServiceClient` or `QueueClient` with connection string.
13+
- Refined user-agent value to avoid failure when os information is not available on some platforms.
1214

1315
### Other Changes
1416

sdk/storage/storage-queue/src/TelemetryPolicyFactory.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ export class TelemetryPolicyFactory implements RequestPolicyFactory {
4444
}
4545

4646
// e.g. (NODE-VERSION 4.9.1; Windows_NT 10.0.16299)
47-
const runtimeInfo = `(NODE-VERSION ${process.version}; ${os.type()} ${os.release()})`;
47+
let runtimeInfo = `(NODE-VERSION ${process.version})`;
48+
if (os) {
49+
runtimeInfo = `(NODE-VERSION ${process.version}; ${os.type()} ${os.release()})`;
50+
}
4851
if (userAgentInfo.indexOf(runtimeInfo) === -1) {
4952
userAgentInfo.push(runtimeInfo);
5053
}

0 commit comments

Comments
 (0)