Skip to content

Commit

Permalink
Merge branch 'master' of github.com:astronautlevel2/Anemone3DS
Browse files Browse the repository at this point in the history
  • Loading branch information
astronautlevel2 committed Jun 12, 2020
2 parents a4532b0 + f819f9d commit d1a821e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions include/remote.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include "common.h"
#include "draw.h"
#include <ctype.h>

#define THEMEPLAZA_BASE_URL "https://themeplaza.eu"
#define THEMEPLAZA_API_URL "/api/anemone/v1"
Expand Down
16 changes: 12 additions & 4 deletions source/remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,10 +807,7 @@ u32 http_get(const char *url, char ** filename, char ** buf, InstallType install
return 0;
}

DEBUG(content_disposition);
char * tok = strtok(content_disposition, "\"");
DEBUG(tok);
tok = strtok(NULL, "\"");
char * tok = strstr(content_disposition, "filename=");

if(!(tok))
{
Expand All @@ -822,6 +819,17 @@ u32 http_get(const char *url, char ** filename, char ** buf, InstallType install
return 0;
}

tok += sizeof("filename=") - 1;
if(ispunct((int)*tok))
{
tok++;
}
char* last_char = tok + strlen(tok) - 1;
if(ispunct((int)*last_char))
{
*last_char = '\0';
}

char *illegal_characters = "\"?;:/\\+";
for (size_t i = 0; i < strlen(tok); i++)
{
Expand Down

0 comments on commit d1a821e

Please sign in to comment.