kopia lustrzana https://gitlab.com/sane-project/backends
Fix parsing location.
rodzic
c66cdfb4ae
commit
2345757725
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue