mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-14 20:33:48 +00:00
Fixed bug with elog:/<n> referencing
SVN revision: 674
This commit is contained in:
parent
c3e7ef2c1a
commit
ac9f916041
43
src/elogd.c
43
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.187 2004/01/13 16:37:27 midas
|
||||||
|
Fixed bug with elog:/<n> referencing
|
||||||
|
|
||||||
Revision 1.186 2004/01/13 15:15:48 midas
|
Revision 1.186 2004/01/13 15:15:48 midas
|
||||||
Fixed disappearing text on edit
|
Fixed disappearing text on edit
|
||||||
|
|
||||||
@ -12346,7 +12349,7 @@ void interprete(char *lbook, char *path)
|
|||||||
char str[NAME_LENGTH], str2[NAME_LENGTH], enc_pwd[80], file_name[256], command[80],
|
char str[NAME_LENGTH], str2[NAME_LENGTH], enc_pwd[80], file_name[256], command[80],
|
||||||
ref[256];
|
ref[256];
|
||||||
char enc_path[256], dec_path[256], logbook[256], logbook_enc[256];
|
char enc_path[256], dec_path[256], logbook[256], logbook_enc[256];
|
||||||
char *experiment, *value, *group, css[256];
|
char *experiment, *value, *group, css[256], *pfile;
|
||||||
char attachment[MAX_PATH_LENGTH];
|
char attachment[MAX_PATH_LENGTH];
|
||||||
BOOL global;
|
BOOL global;
|
||||||
LOGBOOK *lbs;
|
LOGBOOK *lbs;
|
||||||
@ -12711,21 +12714,26 @@ void interprete(char *lbook, char *path)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---- check if file requested -----------------------------------*/
|
/*---- check if file requested -----------------------------------*/
|
||||||
|
|
||||||
if ((strlen(dec_path) > 13 && dec_path[6] == '_' && dec_path[13] == '_')
|
/* stop elog message id in front of possible attachment */
|
||||||
|| (strlen(dec_path) > 13 && dec_path[6] == '_' && dec_path[13] == '/')
|
pfile = dec_path;
|
||||||
|| strstr(dec_path, ".gif")
|
if (strchr(pfile, '/') && pfile[13] != '/')
|
||||||
|| strstr(dec_path, ".jpg") || strstr(dec_path, ".jpeg")
|
pfile = strchr(pfile, '/')+1;
|
||||||
|| strstr(dec_path, ".png") || strstr(dec_path, ".css")) {
|
|
||||||
if ((strlen(dec_path) > 13 && dec_path[6] == '_'
|
if ((strlen(pfile) > 13 && pfile[6] == '_' && pfile[13] == '_')
|
||||||
&& dec_path[13] == '_') || (strlen(dec_path) > 13 && dec_path[6] == '_'
|
|| (strlen(pfile) > 13 && pfile[6] == '_' && pfile[13] == '/')
|
||||||
&& dec_path[13] == '/')) {
|
|| strstr(pfile, ".gif")
|
||||||
if (dec_path[13] == '/')
|
|| strstr(pfile, ".jpg") || strstr(pfile, ".jpeg")
|
||||||
dec_path[13] = '_';
|
|| strstr(pfile, ".png") || strstr(pfile, ".css")) {
|
||||||
|
if ((strlen(pfile) > 13 && pfile[6] == '_'
|
||||||
|
&& pfile[13] == '_') || (strlen(pfile) > 13 && pfile[6] == '_'
|
||||||
|
&& pfile[13] == '/')) {
|
||||||
|
if (pfile[13] == '/')
|
||||||
|
pfile[13] = '_';
|
||||||
/* file from data directory requested */
|
/* file from data directory requested */
|
||||||
strlcpy(file_name, lbs->data_dir, sizeof(file_name));
|
strlcpy(file_name, lbs->data_dir, sizeof(file_name));
|
||||||
strlcat(file_name, dec_path, sizeof(file_name));
|
strlcat(file_name, pfile, sizeof(file_name));
|
||||||
} else {
|
} else {
|
||||||
/* file from theme directory requested */
|
/* file from theme directory requested */
|
||||||
strlcpy(file_name, resource_dir, sizeof(file_name));
|
strlcpy(file_name, resource_dir, sizeof(file_name));
|
||||||
@ -12739,14 +12747,14 @@ void interprete(char *lbook, char *path)
|
|||||||
strlcat(file_name, theme_name, sizeof(file_name));
|
strlcat(file_name, theme_name, sizeof(file_name));
|
||||||
strlcat(file_name, DIR_SEPARATOR_STR, sizeof(file_name));
|
strlcat(file_name, DIR_SEPARATOR_STR, sizeof(file_name));
|
||||||
}
|
}
|
||||||
strlcat(file_name, dec_path, sizeof(file_name));
|
strlcat(file_name, pfile, sizeof(file_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
send_file_direct(file_name);
|
send_file_direct(file_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---- check if attachment requested -----------------------------*/
|
/*---- check if attachment requested -----------------------------*/
|
||||||
|
|
||||||
if (strchr(dec_path, '/')) {
|
if (strchr(dec_path, '/')) {
|
||||||
message_id = atoi(dec_path);
|
message_id = atoi(dec_path);
|
||||||
@ -12756,8 +12764,7 @@ void interprete(char *lbook, char *path)
|
|||||||
sprintf(str, "Attachment #%d of message #%d not found", n + 1, message_id);
|
sprintf(str, "Attachment #%d of message #%d not found", n + 1, message_id);
|
||||||
show_error(str);
|
show_error(str);
|
||||||
} else {
|
} else {
|
||||||
sprintf(str, "../%s", attachment);
|
redirect(lbs, attachment);
|
||||||
redirect(lbs, str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -12795,7 +12802,7 @@ void interprete(char *lbook, char *path)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---- check for various commands --------------------------------*/
|
/*---- check for various commands --------------------------------*/
|
||||||
|
|
||||||
if (equal_ustring(command, loc("Help"))) {
|
if (equal_ustring(command, loc("Help"))) {
|
||||||
if (getcfg(lbs->name, "Help URL", str)) {
|
if (getcfg(lbs->name, "Help URL", str)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user