summaryrefslogtreecommitdiff
path: root/src/gmrequest.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-12-04 21:16:19 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-12-04 21:16:41 +0200
commit9a4032bbba8846d1f5c92b4c39743dc6884f06ec (patch)
treecf43e133677d6d1ea40e87d24e80c3ffbe0062e1 /src/gmrequest.c
parentabec43cd54a14c6d4a74239df97870a83cc474ed (diff)
Windows: Dealing with "file:///" URIs
Diffstat (limited to 'src/gmrequest.c')
-rw-r--r--src/gmrequest.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gmrequest.c b/src/gmrequest.c
index a1284078..2402cc40 100644
--- a/src/gmrequest.c
+++ b/src/gmrequest.c
@@ -526,6 +526,12 @@ void submit_GmRequest(iGmRequest *d) {
526 } 526 }
527 else if (equalCase_Rangecc(url.scheme, "file")) { 527 else if (equalCase_Rangecc(url.scheme, "file")) {
528 iString *path = collect_String(urlDecode_String(collect_String(newRange_String(url.path)))); 528 iString *path = collect_String(urlDecode_String(collect_String(newRange_String(url.path))));
529#if defined (iPlatformMsys)
530 /* Remove the extra slash from the beginning. */
531 if (startsWith_String(path, "/")) {
532 remove_Block(&path->chars, 0, 1);
533 }
534#endif
529 iFile * f = new_File(path); 535 iFile * f = new_File(path);
530 if (open_File(f, readOnly_FileMode)) { 536 if (open_File(f, readOnly_FileMode)) {
531 /* TODO: Check supported file types: images, audio */ 537 /* TODO: Check supported file types: images, audio */
@@ -555,6 +561,9 @@ void submit_GmRequest(iGmRequest *d) {
555 else if (endsWithCase_String(path, ".mp3")) { 561 else if (endsWithCase_String(path, ".mp3")) {
556 setCStr_String(&resp->meta, "audio/mpeg"); 562 setCStr_String(&resp->meta, "audio/mpeg");
557 } 563 }
564 else if (endsWithCase_String(path, ".mid")) {
565 setCStr_String(&resp->meta, "audio/midi");
566 }
558 else { 567 else {
559 setCStr_String(&resp->meta, "application/octet-stream"); 568 setCStr_String(&resp->meta, "application/octet-stream");
560 } 569 }