This commit is contained in:
pandeymangg
2025-09-10 10:38:07 +05:30
parent 145579d864
commit 51b116bd6b
3 changed files with 41 additions and 3 deletions

View File

@@ -64,8 +64,8 @@ jobs:
- 9000:9000
options: >-
--health-cmd="curl -fsS http://localhost:9000/minio/health/live || exit 1"
--health-interval=5s
--health-timeout=2s
--health-interval=10s
--health-timeout=5s
--health-retries=20
steps:
- name: Harden the runner (Audit all outbound calls)
@@ -120,17 +120,34 @@ jobs:
- name: Wait for MinIO and create S3 bucket
run: |
echo "Waiting for MinIO to be ready..."
for i in {1..60}; do
if curl -fsS http://localhost:9000/minio/health/live >/dev/null; then
echo "MinIO is up"
echo "MinIO is up after ${i} seconds"
break
fi
echo "Waiting for MinIO... (attempt ${i}/60)"
sleep 1
done
# Give MinIO a bit more time to fully initialize
sleep 5
echo "Configuring MinIO client..."
mc alias set local http://localhost:9000 minioadmin minioadmin
echo "Creating S3 bucket..."
mc mb --ignore-existing local/formbricks-e2e
echo "Verifying bucket creation..."
mc ls local/
echo "Testing MinIO connectivity..."
curl -fsS http://localhost:9000/minio/health/live && echo "✓ MinIO health check passed"
echo "Testing S3 API endpoint..."
curl -fsS http://localhost:9000/ && echo "✓ MinIO S3 API accessible" || echo "✗ MinIO S3 API not accessible"
- name: Build App
run: |
pnpm build --filter=@formbricks/web...
@@ -173,6 +190,22 @@ jobs:
sleep 10
done
- name: Test Storage and MinIO Integration
run: |
echo "Testing MinIO file upload with mc client..."
# Test file upload using MinIO client
echo "test content" > test-file.txt
mc cp test-file.txt local/formbricks-e2e/test-file.txt
echo "Verifying file was uploaded..."
mc ls local/formbricks-e2e/
echo "Testing file download..."
mc cp local/formbricks-e2e/test-file.txt downloaded-test-file.txt
cat downloaded-test-file.txt
echo "MinIO integration test completed successfully!"
- name: Install Playwright
run: pnpm exec playwright install --with-deps

View File

@@ -1,3 +1,5 @@
import toast from "react-hot-toast";
export enum FileUploadError {
NO_FILE = "No file provided or invalid file type. Expected a File or Blob.",
INVALID_FILE_TYPE = "Please upload an image file.",
@@ -59,6 +61,8 @@ export const handleFileUpload = async (
});
if (!response.ok) {
toast.error(JSON.stringify(response), { duration: 1000 });
if (response.status === 400) {
const json = (await response.json()) as { details?: { fileName?: string } };
if (json.details?.fileName) {

View File

@@ -85,6 +85,7 @@ export const FileInput = ({
if (uploadedFiles.length < allowedFiles.length || uploadedFiles.some((file) => file.error)) {
const firstError = uploadedFiles.find((f) => f.error)?.error;
toast.error(JSON.stringify(uploadedFiles), { duration: 1000 });
if (firstError === FileUploadError.INVALID_FILE_NAME) {
toast.error(t("common.invalid_file_name"));
} else if (uploadedFiles.length === 0) {