diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-12-04 21:16:19 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-12-04 21:16:41 +0200 |
commit | 9a4032bbba8846d1f5c92b4c39743dc6884f06ec (patch) | |
tree | cf43e133677d6d1ea40e87d24e80c3ffbe0062e1 /src/gmrequest.c | |
parent | abec43cd54a14c6d4a74239df97870a83cc474ed (diff) |
Windows: Dealing with "file:///" URIs
Diffstat (limited to 'src/gmrequest.c')
-rw-r--r-- | src/gmrequest.c | 9 |
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 | } |