mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-23 17:33:51 +02:00
Address runtime PR review feedback
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
92a7adca9c
commit
386b1d8e1a
6 files changed
+9
-7
No files matched your search
@@ -352,7 +352,7 @@ describeEmbeddedPostgres("runDatabaseBackup", () => {
|
||||
'11111111-1111-4111-8111-111111111111',
|
||||
'22222222-2222-4222-8222-222222222222',
|
||||
'signal',
|
||||
ARRAY['upstream_import:preview', 'scope with space', 'quoted "scope"'],
|
||||
ARRAY['upstream_import:preview', 'scope with space', 'quoted "scope"', 'NULL', 'null'],
|
||||
jsonb_build_array('json warning', jsonb_build_object('code', 'quoted "value"'))
|
||||
);
|
||||
`);
|
||||
@@ -386,7 +386,7 @@ describeEmbeddedPostgres("runDatabaseBackup", () => {
|
||||
{
|
||||
signal: "signal",
|
||||
title: "case",
|
||||
scopes: ["upstream_import:preview", "scope with space", 'quoted "scope"'],
|
||||
scopes: ["upstream_import:preview", "scope with space", 'quoted "scope"', "NULL", "null"],
|
||||
warnings: ["json warning", { code: 'quoted "value"' }],
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -257,7 +257,7 @@ function formatPostgresArrayElement(value: unknown): string {
|
||||
: typeof value === "object"
|
||||
? JSON.stringify(value)
|
||||
: String(value);
|
||||
if (raw.length === 0 || /[{}\s,"\\]/.test(raw)) {
|
||||
if (raw.length === 0 || /^null$/i.test(raw) || /[{}\s,"\\]/.test(raw)) {
|
||||
return `"${raw.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
|
||||
}
|
||||
return raw;
|
||||
|
||||
@@ -3,6 +3,7 @@ import { ZodError } from "zod";
|
||||
import { HttpError } from "../errors.js";
|
||||
import { trackErrorHandlerCrash } from "@paperclipai/shared/telemetry";
|
||||
import { getTelemetryClient } from "../telemetry.js";
|
||||
import { COMPANY_IMPORT_API_PATH } from "../routes/company-import-paths.js";
|
||||
|
||||
export interface ErrorContext {
|
||||
error: { message: string; stack?: string; name?: string; details?: unknown; raw?: unknown };
|
||||
@@ -83,5 +84,5 @@ export function errorHandler(
|
||||
function shouldExposeTrustedCloudTenantImportError(req: Request) {
|
||||
return req.actor?.source === "cloud_tenant"
|
||||
&& req.method === "POST"
|
||||
&& req.originalUrl.split("?")[0] === "/api/companies/import";
|
||||
&& req.originalUrl.split("?")[0] === COMPANY_IMPORT_API_PATH;
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
} from "../services/index.js";
|
||||
import type { StorageService } from "../storage/types.js";
|
||||
import { assertBoard, assertCompanyAccess, assertInstanceAdmin, getActorInfo } from "./authz.js";
|
||||
import { COMPANY_IMPORT_ROUTE_PATH } from "./company-import-paths.js";
|
||||
|
||||
export function companyRoutes(db: Db, storage?: StorageService) {
|
||||
const router = Router();
|
||||
@@ -176,7 +177,7 @@ export function companyRoutes(db: Db, storage?: StorageService) {
|
||||
res.json(preview);
|
||||
});
|
||||
|
||||
router.post("/import", validate(companyPortabilityImportSchema), async (req, res) => {
|
||||
router.post(COMPANY_IMPORT_ROUTE_PATH, validate(companyPortabilityImportSchema), async (req, res) => {
|
||||
assertBoard(req);
|
||||
assertImportTargetAccess(req, req.body.target);
|
||||
const actor = getActorInfo(req);
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
export const COMPANY_IMPORT_ROUTE_PATH = "/import";
|
||||
export const COMPANY_IMPORT_API_PATH = `/api/companies${COMPANY_IMPORT_ROUTE_PATH}`;
|
||||
@@ -145,8 +145,6 @@ export function Issues() {
|
||||
includeRoutineExecutions: true,
|
||||
limit: issuePageSize,
|
||||
offset: pageParam,
|
||||
sortField: "updated",
|
||||
sortDir: "desc",
|
||||
}),
|
||||
initialPageParam: 0,
|
||||
getNextPageParam: (lastPage, _allPages, lastPageParam) =>
|
||||
|
||||
Reference in new issue
Block a user