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 "common.h"
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#define THEMEPLAZA_BASE_URL "https://themeplaza.eu"
|
#define THEMEPLAZA_BASE_URL "https://themeplaza.eu"
|
||||||
#define THEMEPLAZA_API_URL "/api/anemone/v1"
|
#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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG(content_disposition);
|
char * tok = strstr(content_disposition, "filename=");
|
||||||
char * tok = strtok(content_disposition, "\"");
|
|
||||||
DEBUG(tok);
|
|
||||||
tok = strtok(NULL, "\"");
|
|
||||||
|
|
||||||
if(!(tok))
|
if(!(tok))
|
||||||
{
|
{
|
||||||
@@ -822,6 +819,17 @@ u32 http_get(const char *url, char ** filename, char ** buf, InstallType install
|
|||||||
return 0;
|
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 = "\"?;:/\\+";
|
char *illegal_characters = "\"?;:/\\+";
|
||||||
for (size_t i = 0; i < strlen(tok); i++)
|
for (size_t i = 0; i < strlen(tok); i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user