Fix parsing location.

escl-error-read-jpeg
thierry1970 2020-03-05 12:32:49 +01:00
rodzic c66cdfb4ae
commit 2345757725
1 zmienionych plików z 16 dodań i 10 usunięć

Wyświetl plik

@ -206,17 +206,23 @@ escl_newjob (capabilities_t *scanner, SANE_String_Const name, SANE_Status *statu
} }
else { else {
if (download->memory != NULL) { if (download->memory != NULL) {
if (strstr(download->memory, "Location:")) { char *tmp_location = strstr(download->memory, "Location:");
temporary = strrchr(download->memory, '/'); if (tmp_location) {
temporary = strchr(tmp_location, '\r');
if (temporary == NULL)
temporary = strchr(tmp_location, '\n');
if (temporary != NULL) { if (temporary != NULL) {
location = strchr(temporary, '\r'); *temporary = '\0';
if (location == NULL) location = strrchr(tmp_location,'/');
location = strchr(temporary, '\n'); if (location) {
else { result = strdup(location);
*location = '\0'; DBG( 1, "Create NewJob : %s\n", result);
result = strdup(temporary); *temporary = '\n';
} }
DBG( 1, "Create NewJob : %s\n", result); }
if (result == NULL) {
DBG( 1, "Error : Create NewJob, no location\n");
*status = SANE_STATUS_INVAL;
} }
free(download->memory); free(download->memory);
} }