Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix user export expiration

Chocobozzzae3b487c4299
diff --git a/packages/tests/src/api/users/user-export.ts b/packages/tests/src/api/users/user-export.ts
index 8e06313b90..d35177fb5d 100644
--- a/packages/tests/src/api/users/user-export.ts
+++ b/packages/tests/src/api/users/user-export.ts
@@ -852,6 +852,7 @@ function runTest (withObjectStorage: boolean) {
await server.userExports.request({ userId: noahId, withVideoFiles: true })
await server.userExports.waitForCreation({ userId: noahId })
+ await wait(1500)
const tomorrow = new Date()
tomorrow.setDate(tomorrow.getDate() + 1)
@@ -866,6 +867,13 @@ function runTest (withObjectStorage: boolean) {
await checkExportFileExists({ exists: true, server, userExport, withObjectStorage, redirectedUrl })
+ // Should not delete the file
+ await server.debug.sendCommand({ body: { command: 'remove-expired-user-exports' } })
+ // File deletion
+ await wait(500)
+
+ await checkExportFileExists({ exists: true, server, userExport, withObjectStorage, redirectedUrl })
+
await server.config.updateExistingConfig({
newConfig: {
export: {
@@ -876,11 +884,7 @@ function runTest (withObjectStorage: boolean) {
}
})
- await server.debug.sendCommand({
- body: {
- command: 'remove-expired-user-exports'
- }
- })
+ await server.debug.sendCommand({ body: { command: 'remove-expired-user-exports' } })
// File deletion
await wait(500)
diff --git a/server/core/models/user/user-export.ts b/server/core/models/user/user-export.ts
index d791d893a7..a54ee4e32f 100644
--- a/server/core/models/user/user-export.ts
+++ b/server/core/models/user/user-export.ts
@@ -109,7 +109,7 @@ export class UserExportModel extends SequelizeModel<UserExportModel> {
const query: FindOptions = {
where: {
createdAt: {
- [Op.lt]: new Date(new Date().getTime() + expirationTimeMS)
+ [Op.lt]: new Date(new Date().getTime() - expirationTimeMS)
}
}
}