No longer assume that a QR filename contains a quote (Fixes #204)
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
@@ -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++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user