mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
fix: Missing replacements (#10350)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { IntegrationService, IntegrationType } from "@shared/types";
|
||||
import { Integration } from "@server/models";
|
||||
import { Buckets } from "@server/models/helpers/AttachmentHelper";
|
||||
@@ -27,7 +26,7 @@ export default class UploadLinearWorkspaceLogoTask extends BaseTask<Props> {
|
||||
|
||||
const res = await FileStorage.storeFromUrl(
|
||||
props.logoUrl,
|
||||
`${Buckets.avatars}/${integration.teamId}/${uuidv4()}`,
|
||||
`${Buckets.avatars}/${integration.teamId}/${crypto.randomUUID()}`,
|
||||
"public-read",
|
||||
{
|
||||
headers: {
|
||||
|
||||
@@ -3,7 +3,6 @@ import { readFile } from "fs/promises";
|
||||
import path from "path";
|
||||
import FormData from "form-data";
|
||||
import { ensureDirSync } from "fs-extra";
|
||||
import { v4 as uuidV4 } from "uuid";
|
||||
import { FileOperationState, FileOperationType } from "@shared/types";
|
||||
import env from "@server/env";
|
||||
import { Buckets } from "@server/models/helpers/AttachmentHelper";
|
||||
@@ -135,7 +134,7 @@ describe("#files.get", () => {
|
||||
it("should fail with status 404 if existing file is requested with key", async () => {
|
||||
const user = await buildUser();
|
||||
const fileName = "images.docx";
|
||||
const key = path.join("uploads", user.id, uuidV4(), fileName);
|
||||
const key = path.join("uploads", user.id, crypto.randomUUID(), fileName);
|
||||
|
||||
ensureDirSync(
|
||||
path.dirname(path.join(env.FILE_STORAGE_LOCAL_ROOT_DIR, key))
|
||||
@@ -153,7 +152,7 @@ describe("#files.get", () => {
|
||||
it("should fail with status 404 if non-existing file is requested with key", async () => {
|
||||
const user = await buildUser();
|
||||
const fileName = "images.docx";
|
||||
const key = path.join("uploads", user.id, uuidV4(), fileName);
|
||||
const key = path.join("uploads", user.id, crypto.randomUUID(), fileName);
|
||||
const res = await server.get(`/api/files.get?key=${key}`);
|
||||
expect(res.status).toEqual(404);
|
||||
});
|
||||
@@ -279,7 +278,7 @@ describe("#files.get", () => {
|
||||
|
||||
it("should succeed with status 200 ok when avatar is requested using key", async () => {
|
||||
const user = await buildUser();
|
||||
const key = path.join("avatars", user.id, uuidV4());
|
||||
const key = path.join("avatars", user.id, crypto.randomUUID());
|
||||
const attachment = await buildAttachment({
|
||||
key,
|
||||
teamId: user.teamId,
|
||||
@@ -308,7 +307,7 @@ describe("#files.get", () => {
|
||||
|
||||
it("should succeed with status 200 ok when avatar is requested using key", async () => {
|
||||
const user = await buildUser();
|
||||
const key = path.join("avatars", user.id, uuidV4());
|
||||
const key = path.join("avatars", user.id, crypto.randomUUID());
|
||||
await buildAttachment({
|
||||
key,
|
||||
teamId: user.teamId,
|
||||
@@ -335,7 +334,7 @@ describe("#files.get", () => {
|
||||
it("should succeed with status 200 ok when exported file is requested using signature", async () => {
|
||||
const user = await buildUser();
|
||||
const fileName = "export-markdown.zip";
|
||||
const key = `${Buckets.uploads}/${user.teamId}/${uuidV4()}/${fileName}`;
|
||||
const key = `${Buckets.uploads}/${user.teamId}/${crypto.randomUUID()}/${fileName}`;
|
||||
|
||||
await buildFileOperation({
|
||||
userId: user.id,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import fetchMock from "jest-fetch-mock";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { WebhookDelivery } from "@server/models";
|
||||
import {
|
||||
buildUser,
|
||||
@@ -99,7 +98,7 @@ describe("DeliverWebhookTask", () => {
|
||||
url: "http://example.com",
|
||||
events: ["*"],
|
||||
});
|
||||
const deletedUserId = uuidv4();
|
||||
const deletedUserId = crypto.randomUUID();
|
||||
const signedInUser = await buildUser({ teamId: subscription.teamId });
|
||||
|
||||
const task = new DeliverWebhookTask();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import * as Sentry from "@sentry/react";
|
||||
import { EditorView } from "prosemirror-view";
|
||||
import { toast } from "sonner";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import type { Dictionary } from "~/hooks/useDictionary";
|
||||
import FileHelper from "../lib/FileHelper";
|
||||
import uploadPlaceholderPlugin, {
|
||||
@@ -72,7 +71,7 @@ const insertFiles = async function (
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
id: `upload-${uuidv4()}`,
|
||||
id: `upload-${crypto.randomUUID()}`,
|
||||
dimensions: await getDimensions?.(file),
|
||||
isImage,
|
||||
isVideo,
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
Transaction,
|
||||
} from "prosemirror-state";
|
||||
import { Decoration, DecorationSet } from "prosemirror-view";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { isCode } from "../lib/isCode";
|
||||
import { isRemoteTransaction } from "../lib/multiplayer";
|
||||
import { findBlockNodes } from "../queries/findChildren";
|
||||
@@ -54,7 +53,7 @@ class MermaidRenderer {
|
||||
readonly editor: Editor;
|
||||
|
||||
constructor(editor: Editor) {
|
||||
this.diagramId = uuidv4();
|
||||
this.diagramId = crypto.randomUUID();
|
||||
this.elementId = `mermaid-diagram-wrapper-${this.diagramId}`;
|
||||
this.element =
|
||||
document.getElementById(this.elementId) || document.createElement("div");
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { toggleMark } from "prosemirror-commands";
|
||||
import { MarkSpec, MarkType, Schema, Mark as PMMark } from "prosemirror-model";
|
||||
import { Command, Plugin } from "prosemirror-state";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { addMark } from "../commands/addMark";
|
||||
import { collapseSelection } from "../commands/collapseSelection";
|
||||
import { chainTransactions } from "../lib/chainTransactions";
|
||||
@@ -82,7 +81,7 @@ export default class Comment extends Mark {
|
||||
|
||||
chainTransactions(
|
||||
toggleMark(type, {
|
||||
id: uuidv4(),
|
||||
id: crypto.randomUUID(),
|
||||
userId: this.options.userId,
|
||||
draft: true,
|
||||
}),
|
||||
@@ -112,7 +111,7 @@ export default class Comment extends Mark {
|
||||
|
||||
chainTransactions(
|
||||
addMark(type, {
|
||||
id: uuidv4(),
|
||||
id: crypto.randomUUID(),
|
||||
userId: this.options.userId,
|
||||
draft: true,
|
||||
}),
|
||||
|
||||
@@ -12,9 +12,7 @@ import {
|
||||
Plugin,
|
||||
TextSelection,
|
||||
} from "prosemirror-state";
|
||||
import * as React from "react";
|
||||
import { Primitive } from "utility-types";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import env from "../../env";
|
||||
import { MentionType, UnfurlResourceType, UnfurlResponse } from "../../types";
|
||||
import {
|
||||
@@ -172,7 +170,7 @@ export default class Mention extends Node {
|
||||
node.type.name === this.name &&
|
||||
(!nodeId || existingIds.has(nodeId))
|
||||
) {
|
||||
nodeId = uuidv4();
|
||||
nodeId = crypto.randomUUID();
|
||||
modified = true;
|
||||
tr.setNodeAttribute(pos, "id", nodeId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user