@overmap-ai/core 1.0.44-tiptap.4 → 1.0.44-tiptap.6

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.
@@ -1684,8 +1684,14 @@ const selectAttachmentsOfComponentByType = restructureCreateSelectorWithArgs(
1684
1684
  [selectAllComponentAttachments, (_state, componentId) => componentId],
1685
1685
  (attachments, componentId) => {
1686
1686
  const attachmentsOfComponent = attachments.filter(({ component_id }) => componentId === component_id);
1687
- const fileAttachments = attachmentsOfComponent.filter(({ file_type }) => !file_type.startsWith("image/"));
1688
- const imageAttachments = attachmentsOfComponent.filter(({ file_type }) => file_type.startsWith("image/"));
1687
+ const fileAttachments = attachmentsOfComponent.filter(
1688
+ // this null check here is necessary, there are cases where file_type is null or undefined
1689
+ ({ file_type }) => !file_type || !file_type.startsWith("image/")
1690
+ );
1691
+ const imageAttachments = attachmentsOfComponent.filter(
1692
+ // this null check here is necessary, there are cases where file_type is null or undefined
1693
+ ({ file_type }) => file_type && file_type.startsWith("image/")
1694
+ );
1689
1695
  return { fileAttachments, imageAttachments };
1690
1696
  }
1691
1697
  )
@@ -1950,8 +1956,14 @@ const selectAttachmentsOfComponentTypeByType = restructureCreateSelectorWithArgs
1950
1956
  const attachmentsOfComponent = attachments.filter(
1951
1957
  ({ component_type_id }) => component_type_id === componentTypeId
1952
1958
  );
1953
- const fileAttachments = attachmentsOfComponent.filter(({ file_type }) => !file_type.startsWith("image/"));
1954
- const imageAttachments = attachmentsOfComponent.filter(({ file_type }) => file_type.startsWith("image/"));
1959
+ const fileAttachments = attachmentsOfComponent.filter(
1960
+ // this null check here is necessary, there are cases where file_type is null or undefined
1961
+ ({ file_type }) => !file_type || !file_type.startsWith("image/")
1962
+ );
1963
+ const imageAttachments = attachmentsOfComponent.filter(
1964
+ // this null check here is necessary, there are cases where file_type is null or undefined
1965
+ ({ file_type }) => file_type && file_type.startsWith("image/")
1966
+ );
1955
1967
  return { fileAttachments, imageAttachments };
1956
1968
  }
1957
1969
  )
@@ -2251,8 +2263,14 @@ const selectAttachmentsOfIssueByType = restructureCreateSelectorWithArgs(
2251
2263
  [selectIssueAttachments, (_state, issueId) => issueId],
2252
2264
  (attachments, issueId) => {
2253
2265
  const attachmentsOfComponent = attachments.filter(({ issue_id }) => issue_id === issueId);
2254
- const fileAttachments = attachmentsOfComponent.filter(({ file_type }) => !file_type.startsWith("image/"));
2255
- const imageAttachments = attachmentsOfComponent.filter(({ file_type }) => file_type.startsWith("image/"));
2266
+ const fileAttachments = attachmentsOfComponent.filter(
2267
+ // this null check here is necessary, there are cases where file_type is null or undefined
2268
+ ({ file_type }) => !file_type || !file_type.startsWith("image/")
2269
+ );
2270
+ const imageAttachments = attachmentsOfComponent.filter(
2271
+ // this null check here is necessary, there are cases where file_type is null or undefined
2272
+ ({ file_type }) => file_type && file_type.startsWith("image/")
2273
+ );
2256
2274
  return { fileAttachments, imageAttachments };
2257
2275
  }
2258
2276
  )
@@ -6522,18 +6540,23 @@ class FileService extends BaseApiService {
6522
6540
  let promise = cachedRequestPromises[requestCacheKey];
6523
6541
  let isFirstRequest = true;
6524
6542
  if (!promise) {
6525
- promise = this.enqueueRequest({
6526
- description: "Download file",
6527
- method: HttpMethod.GET,
6528
- url,
6529
- // If in development, we should assume the files are saved at localhost by the Django development server.
6530
- // Setting this to true will lead to localhost:8000 being prepended to the URL.
6531
- isExternalUrl: true,
6532
- isResponseBlob: true,
6533
- isAuthNeeded: false,
6534
- blockers: [expectedSha1],
6535
- blocks: [expectedSha1]
6536
- }).then((blob) => new File([blob], downloadedName ?? expectedSha1, { type: blob.type }));
6543
+ promise = new Promise((resolve) => {
6544
+ void this.enqueueRequest({
6545
+ description: "Download file",
6546
+ method: HttpMethod.GET,
6547
+ url,
6548
+ // If in development, we should assume the files are saved at localhost by the Django development server.
6549
+ // Setting this to true will lead to localhost:8000 being prepended to the URL.
6550
+ isExternalUrl: true,
6551
+ isResponseBlob: true,
6552
+ isAuthNeeded: false,
6553
+ blockers: [expectedSha1],
6554
+ blocks: [expectedSha1]
6555
+ }).then((blob) => {
6556
+ const blobToFile = new File([blob], downloadedName ?? expectedSha1, { type: blob.type });
6557
+ resolve(blobToFile);
6558
+ });
6559
+ });
6537
6560
  cachedRequestPromises[requestCacheKey] = promise;
6538
6561
  } else {
6539
6562
  isFirstRequest = false;