code7-leia 0.2.16 → 0.2.18

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.
@@ -2203,50 +2203,53 @@ function uploadFilesSaga(action) {
2203
2203
  _action$payload4 = action.payload, id = _action$payload4.id, file = _action$payload4.file, pressets = _action$payload4.pressets, token = _action$payload4.token;
2204
2204
  blob = new Blob([file.content]);
2205
2205
  formData = new FormData();
2206
- sanitizedPath = file.properties.path.replace(/^\/+|\/+$/g, '');
2206
+ sanitizedPath = file.properties.path.replace(/^(\.\/|\/+)|\/+$/g, '');
2207
+ console.log('sanitizedPath: ', sanitizedPath);
2207
2208
  formData.append('file', blob, sanitizedPath || 'default_filename');
2209
+ console.log('formData: ', formData);
2210
+ console.log('file: ', file);
2208
2211
  queryParams = pressets.length ? new URLSearchParams({
2209
2212
  tags: pressets.join(',')
2210
2213
  }).toString() : '';
2211
2214
  url = queryParams ? "/upload/" + id + "?token=" + token + "&" + queryParams : "/upload/" + id + "?token=" + token;
2212
- _context4.next = 13;
2215
+ _context4.next = 16;
2213
2216
  return effects.call(api.post, url, formData, {
2214
2217
  headers: {
2215
2218
  'Content-Type': 'multipart/form-data'
2216
2219
  }
2217
2220
  });
2218
- case 13:
2219
- _context4.next = 15;
2221
+ case 16:
2222
+ _context4.next = 18;
2220
2223
  return effects.call(api.get, "/training/" + id + "?token=" + token);
2221
- case 15:
2224
+ case 18:
2222
2225
  _yield$call4 = _context4.sent;
2223
2226
  data = _yield$call4.data;
2224
- _context4.next = 19;
2227
+ _context4.next = 22;
2225
2228
  return effects.put(uploadFilesActionSuccess({
2226
2229
  files: data.files
2227
2230
  }));
2228
- case 19:
2229
- _context4.next = 25;
2231
+ case 22:
2232
+ _context4.next = 28;
2230
2233
  break;
2231
- case 21:
2232
- _context4.prev = 21;
2234
+ case 24:
2235
+ _context4.prev = 24;
2233
2236
  _context4.t0 = _context4["catch"](1);
2234
2237
  toast.error({
2235
2238
  title: t.toast.uploadFile.fail.title,
2236
2239
  description: t.toast.uploadFile.fail.description
2237
2240
  });
2238
2241
  console.log('-----------uploadFilesSaga.error------------------->', _context4.t0);
2239
- case 25:
2240
- _context4.prev = 25;
2241
- _context4.next = 28;
2242
- return effects.put(commonLoadingFinish());
2243
2242
  case 28:
2244
- return _context4.finish(25);
2245
- case 29:
2243
+ _context4.prev = 28;
2244
+ _context4.next = 31;
2245
+ return effects.put(commonLoadingFinish());
2246
+ case 31:
2247
+ return _context4.finish(28);
2248
+ case 32:
2246
2249
  case "end":
2247
2250
  return _context4.stop();
2248
2251
  }
2249
- }, _marked4, null, [[1, 21, 25, 29]]);
2252
+ }, _marked4, null, [[1, 24, 28, 32]]);
2250
2253
  }
2251
2254
  function TrainingSaga(action) {
2252
2255
  var t, _action$payload5, id, pressets, token, tag, queryParams, _yield$call5, data;