@ohos-ports/react-native-fs 2.20.0-beta.0 → 2.20.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/FS.common.js +16 -1
  2. package/package.json +1 -1
package/FS.common.js CHANGED
@@ -281,8 +281,23 @@ var RNFSManager = {
281
281
  reject(new Error('Maximum redirect count reached'));
282
282
  return;
283
283
  }
284
+ // HarmonyOS (openharmony/arm64) node:http client mitigation: issuing the
285
+ // redirect follow-up request while the 3xx response is still being
286
+ // processed (from inside the response callback stack) is unreliable on
287
+ // this platform. Defer the next hop until this 3xx response stream has
288
+ // been fully consumed and has emitted 'end'.
284
289
  res.resume();
285
- doRequest(new URL(res.headers.location, parsed).toString(), redirects + 1);
290
+ res.on('end', function () {
291
+ doRequest(new URL(res.headers.location, parsed).toString(), redirects + 1);
292
+ });
293
+ res.on('error', function (e) {
294
+ // a mid-flight error on the 3xx stream must reject the download
295
+ // instead of leaving the job hanging without a follow-up request
296
+ if (!failed) {
297
+ failed = true;
298
+ reject(e);
299
+ }
300
+ });
286
301
  return;
287
302
  }
288
303
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohos-ports/react-native-fs",
3
- "version": "2.20.0-beta.0",
3
+ "version": "2.20.0-beta.1",
4
4
  "description": "Native filesystem access for react-native — HarmonyOS Node.js port (node:fs/node:http bridge)",
5
5
  "main": "FS.common.js",
6
6
  "typings": "index.d.ts",