Skip to content

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

Fix running again object storage move job

Chocobozzzd95195cf18a3
diff --git a/packages/tests/src/cli/create-move-video-storage-job.ts b/packages/tests/src/cli/create-move-video-storage-job.ts
index f29a4b737d..97bb326356 100644
--- a/packages/tests/src/cli/create-move-video-storage-job.ts
+++ b/packages/tests/src/cli/create-move-video-storage-job.ts
@@ -16,6 +16,7 @@ import {
} from '@peertube/peertube-server-commands'
import { checkDirectoryIsEmpty } from '@tests/shared/directories.js'
import { completeCheckHlsPlaylist } from '@tests/shared/streaming-playlists.js'
+import { expect } from 'chai'
import { join } from 'path'
import { expectStartWith } from '../shared/checks.js'
@@ -168,6 +169,15 @@ describe('Test create move video storage job CLI', function () {
}
})
+ it('Should not re-move all files', async function () {
+ const command = `npm run create-move-video-storage-job -- --to-object-storage --all-videos`
+ const { stdout } = await servers[0].cli.execWithEnv(command, objectStorage.getDefaultMockConfig())
+
+ expect(stdout).to.not.include('Creating external storage move job ')
+
+ await waitJobs(servers)
+ })
+
it('Should not have files on disk anymore', async function () {
await checkDirectoryIsEmpty(servers[0], 'captions', [ 'private' ])
@@ -232,6 +242,15 @@ describe('Test create move video storage job CLI', function () {
}
})
+ it('Should not re-move all files', async function () {
+ const command = `npm run create-move-video-storage-job -- --to-file-system --all-videos`
+ const { stdout } = await servers[0].cli.execWithEnv(command, objectStorage.getDefaultMockConfig())
+
+ expect(stdout).to.not.include('Creating external storage move job ')
+
+ await waitJobs(servers)
+ })
+
it('Should not have files on disk anymore', async function () {
for (const fileUrl of oldFileUrls) {
await makeRawRequest({ url: fileUrl, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
diff --git a/server/core/helpers/image-utils.ts b/server/core/helpers/image-utils.ts
index e1471e6be1..a140717bc7 100644
--- a/server/core/helpers/image-utils.ts
+++ b/server/core/helpers/image-utils.ts
@@ -117,7 +117,6 @@ async function autoResize (options: {
}) {
const { sharpInstance, metadata, newSize, destination } = options
- // Portrait/square input to landscape target
const sourceIsPortraitOrSquare = metadata.width <= metadata.height
const destIsPortraitOrSquare = newSize.width <= newSize.height
diff --git a/server/core/lib/move-storage/shared/move-video.ts b/server/core/lib/move-storage/shared/move-video.ts
index aa2ae6e403..566807815a 100644
--- a/server/core/lib/move-storage/shared/move-video.ts
+++ b/server/core/lib/move-storage/shared/move-video.ts
@@ -119,8 +119,8 @@ export async function filterVideoResourcesToBeMoved (videoArg: MVideo, targetSto
if (c.storage !== targetStorage) return true
if (hls) {
- if (targetStorage === FileStorage.OBJECT_STORAGE) return !c.m3u8Filename || !c.m3u8Url
- else if (targetStorage === FileStorage.FILE_SYSTEM) return !c.m3u8Filename || c.m3u8Url
+ if (targetStorage === FileStorage.OBJECT_STORAGE) return !c.m3u8Filename
+ else if (targetStorage === FileStorage.FILE_SYSTEM) return !c.m3u8Filename
}
return false