Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/tall-months-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"uploadthing": patch
---

Fix deprecation warning being triggered on every upload due to deprecated
getters being accessed internally.
2 changes: 2 additions & 0 deletions packages/uploadthing/src/_internal/upload-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export const uploadWithoutProgress = (

return {
...json,
_internalUrl: json.url,
_internalAppUrl: json.appUrl,
get url() {
logDeprecationWarning(
"`file.url` is deprecated and will be removed in uploadthing v9. Use `file.ufsUrl` instead.",
Expand Down
15 changes: 13 additions & 2 deletions packages/uploadthing/src/sdk/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {
MaybeUrl,
SerializedUploadThingError,
} from "@uploadthing/shared";
import { logDeprecationWarning } from "uploadthing/_internal/deprecations";

import { IngestUrl, UTToken } from "../_internal/config";
import { uploadWithoutProgress } from "../_internal/upload-server";
Expand Down Expand Up @@ -146,8 +147,18 @@ export const uploadFile = (

return {
key: presigned.key,
url: response.url,
appUrl: response.appUrl,
get url() {
logDeprecationWarning(
"`file.url` is deprecated and will be removed in uploadthing v9. Use `file.ufsUrl` instead.",
);
return response._internalUrl;
},
get appUrl() {
logDeprecationWarning(
"`file.appUrl` is deprecated and will be removed in uploadthing v9. Use `file.ufsUrl` instead.",
);
return response._internalAppUrl;
},
ufsUrl: response.ufsUrl,
lastModified: file.lastModified ?? Date.now(),
name: file.name,
Expand Down