Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
cb9fc415
Commit
cb9fc415
authored
3 years ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
Fix issues with file header fields getting repeated (cloned)
e.g. when using the JS FileBase.update() method
parent
567c86d7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sbbs3/filedat.c
+5
-4
5 additions, 4 deletions
src/sbbs3/filedat.c
src/sbbs3/js_filebase.c
+8
-7
8 additions, 7 deletions
src/sbbs3/js_filebase.c
with
13 additions
and
11 deletions
src/sbbs3/filedat.c
+
5
−
4
View file @
cb9fc415
...
...
@@ -615,13 +615,13 @@ int file_sauce_hfields(file_t* f, struct sauce_charinfo* info)
if
(
info
==
NULL
)
return
-
1
;
if
(
*
info
->
author
&&
(
i
=
smb_hfield_str
(
f
,
SMB_AUTHOR
,
info
->
author
))
!=
SMB_SUCCESS
)
if
(
*
info
->
author
&&
(
i
=
smb_
new_
hfield_str
(
f
,
SMB_AUTHOR
,
info
->
author
))
!=
SMB_SUCCESS
)
return
i
;
if
(
*
info
->
group
&&
(
i
=
smb_hfield_str
(
f
,
SMB_AUTHOR_ORG
,
info
->
group
))
!=
SMB_SUCCESS
)
if
(
*
info
->
group
&&
(
i
=
smb_
new_
hfield_str
(
f
,
SMB_AUTHOR_ORG
,
info
->
group
))
!=
SMB_SUCCESS
)
return
i
;
if
(
f
->
desc
==
NULL
&&
*
info
->
title
&&
(
i
=
smb_hfield_str
(
f
,
SMB_FILEDESC
,
info
->
title
))
!=
SMB_SUCCESS
)
if
(
f
->
desc
==
NULL
&&
*
info
->
title
&&
(
i
=
smb_
new_
hfield_str
(
f
,
SMB_FILEDESC
,
info
->
title
))
!=
SMB_SUCCESS
)
return
i
;
return
SMB_SUCCESS
;
...
...
@@ -636,7 +636,8 @@ bool addfile(scfg_t* cfg, uint dirnum, file_t* f, const char* extdesc, client_t*
return
false
;
getfilepath
(
cfg
,
f
,
fpath
);
file_client_hfields
(
f
,
client
);
if
(
f
->
from_ip
==
NULL
)
file_client_hfields
(
f
,
client
);
str_list_t
list
=
list_archive_contents
(
fpath
,
/* pattern: */
NULL
,(
cfg
->
dir
[
dirnum
]
->
misc
&
DIR_NOHASH
)
==
0
,
/* error: */
NULL
,
/* size: */
0
);
int
result
=
smb_addfile_withlist
(
&
smb
,
f
,
SMB_SELFPACK
,
extdesc
,
list
,
fpath
);
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/js_filebase.c
+
8
−
7
View file @
cb9fc415
...
...
@@ -494,7 +494,7 @@ parse_file_properties(JSContext *cx, JSObject* obj, file_t* file, char** extdesc
JS_ReportError
(
cx
,
"Invalid '%s' string in file object"
,
prop_name
);
return
SMB_FAILURE
;
}
if
(
smb_hfield_str
(
file
,
SENDERIPADDR
,
cp
)
!=
SMB_SUCCESS
)
{
if
(
smb_
new_
hfield_str
(
file
,
SENDERIPADDR
,
cp
)
!=
SMB_SUCCESS
)
{
free
(
cp
);
JS_ReportError
(
cx
,
"Error %d adding '%s' property to file object"
,
result
,
prop_name
);
return
result
;
...
...
@@ -509,7 +509,7 @@ parse_file_properties(JSContext *cx, JSObject* obj, file_t* file, char** extdesc
JS_ReportError
(
cx
,
"Invalid '%s' string in file object"
,
prop_name
);
return
SMB_FAILURE
;
}
if
(
smb_hfield_str
(
file
,
SENDERHOSTNAME
,
cp
)
!=
SMB_SUCCESS
)
{
if
(
smb_
new_
hfield_str
(
file
,
SENDERHOSTNAME
,
cp
)
!=
SMB_SUCCESS
)
{
free
(
cp
);
JS_ReportError
(
cx
,
"Error %d adding '%s' property to file object"
,
result
,
prop_name
);
return
result
;
...
...
@@ -524,7 +524,7 @@ parse_file_properties(JSContext *cx, JSObject* obj, file_t* file, char** extdesc
JS_ReportError
(
cx
,
"Invalid '%s' string in file object"
,
prop_name
);
return
SMB_FAILURE
;
}
if
(
smb_hfield_str
(
file
,
SENDERPROTOCOL
,
cp
)
!=
SMB_SUCCESS
)
{
if
(
smb_
new_
hfield_str
(
file
,
SENDERPROTOCOL
,
cp
)
!=
SMB_SUCCESS
)
{
free
(
cp
);
JS_ReportError
(
cx
,
"Error %d adding '%s' property to file object"
,
result
,
prop_name
);
return
result
;
...
...
@@ -539,7 +539,7 @@ parse_file_properties(JSContext *cx, JSObject* obj, file_t* file, char** extdesc
JS_ReportError
(
cx
,
"Invalid '%s' string in file object"
,
prop_name
);
return
SMB_FAILURE
;
}
if
(
smb_hfield_str
(
file
,
SENDERPORT
,
cp
)
!=
SMB_SUCCESS
)
{
if
(
smb_
new_
hfield_str
(
file
,
SENDERPORT
,
cp
)
!=
SMB_SUCCESS
)
{
free
(
cp
);
JS_ReportError
(
cx
,
"Error %d adding '%s' property to file object"
,
result
,
prop_name
);
return
result
;
...
...
@@ -554,7 +554,7 @@ parse_file_properties(JSContext *cx, JSObject* obj, file_t* file, char** extdesc
JS_ReportError
(
cx
,
"Invalid '%s' string in file object"
,
prop_name
);
return
SMB_FAILURE
;
}
if
(
smb_hfield_str
(
file
,
SMB_AUTHOR
,
cp
)
!=
SMB_SUCCESS
)
{
if
(
smb_
new_
hfield_str
(
file
,
SMB_AUTHOR
,
cp
)
!=
SMB_SUCCESS
)
{
free
(
cp
);
JS_ReportError
(
cx
,
"Error %d adding '%s' property to file object"
,
result
,
prop_name
);
return
result
;
...
...
@@ -569,7 +569,7 @@ parse_file_properties(JSContext *cx, JSObject* obj, file_t* file, char** extdesc
JS_ReportError
(
cx
,
"Invalid '%s' string in file object"
,
prop_name
);
return
SMB_FAILURE
;
}
if
(
smb_hfield_str
(
file
,
SMB_AUTHOR_ORG
,
cp
)
!=
SMB_SUCCESS
)
{
if
(
smb_
new_
hfield_str
(
file
,
SMB_AUTHOR_ORG
,
cp
)
!=
SMB_SUCCESS
)
{
free
(
cp
);
JS_ReportError
(
cx
,
"Error %d adding '%s' property to file object"
,
result
,
prop_name
);
return
result
;
...
...
@@ -1234,7 +1234,8 @@ js_add_file(JSContext *cx, uintN argc, jsval *arglist)
}
char
fpath
[
MAX_PATH
+
1
];
getfilepath
(
scfg
,
&
file
,
fpath
);
file_client_hfields
(
&
file
,
client
);
if
(
file
.
from_ip
==
NULL
)
file_client_hfields
(
&
file
,
client
);
str_list_t
list
=
list_archive_contents
(
fpath
,
/* pattern: */
NULL
,(
scfg
->
dir
[
file
.
dir
]
->
misc
&
DIR_NOHASH
)
==
0
,
/* error: */
NULL
,
/* size: */
0
);
p
->
smb_result
=
smb_addfile_withlist
(
&
p
->
smb
,
&
file
,
SMB_SELFPACK
,
extdesc
,
list
,
fpath
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment