Skip to content

Commit d3be166

Browse files
committed
Use filename given in request to build filename in response
1 parent ce2ffaa commit d3be166

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

go_capture/views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import io
2+
from pathlib import Path
23

34
import cv2
45
import numpy as np
@@ -19,9 +20,11 @@ def capture(request):
1920
file = io.StringIO()
2021
make_sgf(file, black, white)
2122
file.seek(0)
23+
filename = Path(image_file.name).stem
2224
return FileResponse(
2325
file.read(),
2426
status=201,
27+
filename=f'${filename}.sgf',
2528
as_attachment=True,
2629
content_type='application/x-go-sgf'
2730
)

0 commit comments

Comments
 (0)