xjs-common 9.0.1 → 9.0.3

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.
@@ -27,6 +27,7 @@ exports.HttpResolverContext = exports.s_clientMode = void 0;
27
27
  const tls = __importStar(require("tls"));
28
28
  const zlib = __importStar(require("zlib"));
29
29
  const fs = __importStar(require("fs"));
30
+ const path = __importStar(require("path"));
30
31
  const url_1 = require("url");
31
32
  const https_1 = require("https");
32
33
  const http_1 = require("http");
@@ -219,7 +220,7 @@ class HttpResolverContext {
219
220
  }
220
221
  catch (e) {
221
222
  if (e instanceof xjs_err_1.XjsErr)
222
- throw e;
223
+ reject(e);
223
224
  else {
224
225
  this.error(e);
225
226
  reject(new xjs_err_1.XjsErr(s_errCode, "Failed to download a file."));
@@ -261,10 +262,8 @@ class HttpResolverContext {
261
262
  if (opPath) {
262
263
  const st = u_file_1.UFile.status(opPath);
263
264
  if (!st || st.isFile()) {
264
- const pathArray = opPath.split("/");
265
- pathArray.pop();
266
- if (!u_file_1.UFile.exists(pathArray))
267
- throw new xjs_err_1.XjsErr(s_errCode, "Directory of the download path was not found.");
265
+ if (!u_file_1.UFile.exists(path.dirname(opPath)))
266
+ throw new xjs_err_1.XjsErr(s_errCode, "Directory of the download file was not found.");
268
267
  return opPath;
269
268
  }
270
269
  if (st.isDirectory()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xjs-common",
3
- "version": "9.0.1",
3
+ "version": "9.0.3",
4
4
  "description": "library modules for nodejs + typescript that bundled general-purpose implementations.",
5
5
  "repository": {
6
6
  "type": "git",