Skip to content

Commit 30b58e4

Browse files
committed
allow m4a audio uploads (#1384)
m4a is an increasingly common and default audio extension and container that LF should support. Fixes #1383 This also adds a Makefile target for playwright-tests, the result of me attempting to write a test for this PR, but which was not included due to no existing lexicon tests and the complexity in writing the first one. * allow m4a audio uploads * add playwright-tests Makefile target
1 parent ebaf889 commit 30b58e4

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

docker/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ start: build
99
dev: start
1010
docker-compose up -d ui-builder
1111

12+
.PHONY: playwright-tests
13+
playwright-tests:
14+
15+
# delete any cached session storage state files if the service isn't running
16+
docker compose ps app-for-playwright > /dev/null 2>&1 || rm -f ../*-storageState.json
17+
18+
docker-compose up -d app-for-playwright
19+
20+
# wait until the app-for-playwright service is serving up HTTP before continuing
21+
until curl localhost:3238 > /dev/null 2>&1; do sleep 1; done
22+
23+
cd .. && npx playwright install && npx playwright test
24+
1225
.PHONY: e2e-tests
1326
e2e-tests:
1427
docker-compose build app-for-e2e test-e2e

docker/docker-compose.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ services:
211211
command: sh -c "/wait && /run.sh"
212212

213213
app-for-playwright:
214+
build:
215+
context: ..
216+
dockerfile: docker/app/Dockerfile
217+
args:
218+
- ENVIRONMENT=development
214219
image: lf-app
215220
container_name: app-for-playwright
216221
platform: linux/amd64

src/Api/Model/Languageforge/Lexicon/Command/LexUploadCommands.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ public static function uploadAudioFile($projectId, $mediaType, $tmpFilePath)
5252

5353
$allowedTypes = array(
5454
"application/octet-stream",
55+
56+
// allow m4a audio uploads, which curiously has a mime type of video/mp4
57+
"video/mp4",
58+
5559
"audio/mpeg",
5660
"audio/x-mpeg",
5761
"audio/mp3",
@@ -68,6 +72,7 @@ public static function uploadAudioFile($projectId, $mediaType, $tmpFilePath)
6872
".mp3",
6973
".mpa",
7074
".mpg",
75+
".m4a",
7176
".wav"
7277
);
7378

0 commit comments

Comments
 (0)