• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

endatix / endatix-hub / 26227430372

21 May 2026 12:58PM UTC coverage: 52.52% (+0.3%) from 52.227%
26227430372

Pull #644

github

PeterMarinov
Adding dedicate content-object-path with tests; fixing template preview on forms create sheet
Pull Request #644: fix: Adding dedicate content-object-path assertion

1384 of 2336 branches covered (59.25%)

Branch coverage included in aggregate %.

9 of 9 new or added lines in 3 files covered. (100.0%)

14 existing lines in 5 files now uncovered.

5692 of 11137 relevant lines covered (51.11%)

11.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.3
/features/form-access/assert-path/assert-hub-object-access.ts
1
import type { ClientStorageConfig } from "@/features/asset-storage/infrastructure/providers/shared/client-storage-config";
2
import type { ParsedStorageObjectUrl } from "@/features/asset-storage/utils";
3
import type { HubStorageScope } from "../types";
4
import { assertUserFileBlobPath } from "./assert-user-file-blob-path";
5
import {
6
  isContentObjectPath,
7
  isFormContentObjectPath,
8
  isTemplateContentObjectPath,
9
} from "./content-object-path";
10

11
/** Hub read-urls: content allows scoped or elevated `f/*`/`t/*` keys; user-files require form + submission. */
12
export function assertHubObjectAccess(
13
  parsed: ParsedStorageObjectUrl,
14
  scope: HubStorageScope,
15
  storageConfig: ClientStorageConfig,
16
): string | null {
17
  const userFilesContainer =
18
    storageConfig.containerNames.USER_FILES.toLowerCase();
8✔
19
  const contentContainer = storageConfig.containerNames.CONTENT.toLowerCase();
8✔
20
  const container = parsed.containerName.toLowerCase();
8✔
21
  const blobName = parsed.blobName;
8✔
22

23
  if (container === contentContainer) {
8✔
24
    if (!isContentObjectPath(blobName)) {
6✔
25
      return "Content object is not in hub content namespace";
1✔
26
    }
27

28
    if (scope.formId && isFormContentObjectPath(blobName, scope.formId)) {
5✔
29
      return null;
1✔
30
    }
31

32
    if (
4✔
33
      scope.templateId &&
34
      isTemplateContentObjectPath(blobName, scope.templateId)
35
    ) {
36
      return null;
1✔
37
    }
38

39
    // Hub editors may presign any content asset until per-image DB permissions exist.
40
    return null;
3✔
41
  }
42

43
  if (container !== userFilesContainer) {
2✔
UNCOV
44
    return "Unknown storage container";
×
45
  }
46

47
  if (!scope.formId) {
2✔
UNCOV
48
    return "Form context is required for user file access";
×
49
  }
50

51
  return assertUserFileBlobPath(
2✔
52
    blobName,
53
    { formId: scope.formId, submissionId: scope.submissionId },
54
    { requireSubmission: true },
55
  );
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc