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
bad3a502
Commit
bad3a502
authored
4 years ago
by
echicken
Browse files
Options
Downloads
Patches
Plain Diff
Some tidying up, I guess
parent
56e634dd
No related branches found
No related tags found
1 merge request
!463
MRC mods by Codefenix (2024-10-20)
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
webv4/root/api/attachments.ssjs
+13
-15
13 additions, 15 deletions
webv4/root/api/attachments.ssjs
with
13 additions
and
15 deletions
webv4/root/api/attachments.ssjs
+
13
−
15
View file @
bad3a502
...
@@ -11,25 +11,21 @@ function barfOut(err) {
...
@@ -11,25 +11,21 @@ function barfOut(err) {
exit
();
exit
();
}
}
if
(
typeof
http_request
.
query
.
sub
===
'
undefined
'
||
if
(
http_request
.
query
.
sub
===
undefined
||
(
http_request
.
query
.
sub
[
0
]
!==
'
mail
'
&&
msg_area
.
sub
[
http_request
.
query
.
sub
[
0
]]
===
undefined
))
{
(
http_request
.
query
.
sub
[
0
]
!==
'
mail
'
&&
typeof
msg_area
.
sub
[
http_request
.
query
.
sub
[
0
]]
===
'
undefined
'
)
)
{
barfOut
(
'
Invalid sub.
'
);
barfOut
(
'
Invalid sub.
'
);
}
}
var
sub
=
http_request
.
query
.
sub
[
0
];
var
sub
=
http_request
.
query
.
sub
[
0
];
if
(
typeof
http_request
.
query
.
msg
===
'
undefined
'
)
{
if
(
http_request
.
query
.
msg
===
undefined
)
{
barfOut
(
'
No message number provided.
'
);
barfOut
(
'
No message number provided.
'
);
}
}
var
id
=
parseInt
(
http_request
.
query
.
msg
[
0
]);
var
id
=
parseInt
(
http_request
.
query
.
msg
[
0
]);
if
(
typeof
http_request
.
query
.
cid
!==
'
undefined
'
)
{
if
(
http_request
.
query
.
cid
!==
undefined
)
{
var
cid
=
http_request
.
query
.
cid
[
0
];
var
cid
=
http_request
.
query
.
cid
[
0
];
}
else
if
(
typeof
http_request
.
query
.
filename
!==
'
undefined
'
)
{
}
else
if
(
http_request
.
query
.
filename
!==
undefined
)
{
var
filename
=
http_request
.
query
.
filename
[
0
];
var
filename
=
http_request
.
query
.
filename
[
0
];
}
else
{
}
else
{
barfOut
(
'
No attachment specified.
'
);
barfOut
(
'
No attachment specified.
'
);
...
@@ -40,7 +36,7 @@ if (!msgBase.open()) barfOut('Unable to open MsgBase ' + sub);
...
@@ -40,7 +36,7 @@ if (!msgBase.open()) barfOut('Unable to open MsgBase ' + sub);
var
header
=
msgBase
.
get_msg_header
(
false
,
id
);
var
header
=
msgBase
.
get_msg_header
(
false
,
id
);
if
(
header
===
null
)
barfOut
(
'
No such message.
'
);
if
(
header
===
null
)
barfOut
(
'
No such message.
'
);
if
(
typeof
msgBase
.
cfg
===
'
undefined
'
&&
header
.
to_ext
!=
user
.
number
)
{
if
(
msgBase
.
cfg
===
undefined
&&
header
.
to_ext
!=
user
.
number
)
{
barfOut
(
'
Not your message.
'
);
barfOut
(
'
Not your message.
'
);
}
}
...
@@ -48,16 +44,18 @@ var body = msgBase.get_msg_body(false, id, header);
...
@@ -48,16 +44,18 @@ var body = msgBase.get_msg_body(false, id, header);
if
(
body
===
null
)
barfOut
(
'
Cannot read message body!
'
);
if
(
body
===
null
)
barfOut
(
'
Cannot read message body!
'
);
msgBase
.
close
();
msgBase
.
close
();
if
(
typeof
cid
!==
'
undefined
'
)
{
msgBase
=
undefined
;
if
(
cid
!==
undefined
)
{
var
att
=
mime_get_cid_attach
(
header
,
body
,
cid
);
var
att
=
mime_get_cid_attach
(
header
,
body
,
cid
);
}
else
if
(
typeof
filename
!==
'
undefined
'
)
{
}
else
if
(
filename
!==
undefined
)
{
var
att
=
mime_get_attach
(
header
,
body
,
filename
);
var
att
=
mime_get_attach
(
header
,
body
,
filename
);
}
}
if
(
typeof
att
!=
'
undefined
'
)
{
if
(
att
!==
undefined
)
{
if
(
typeof
att
.
content_type
!==
'
undefined
'
)
{
if
(
att
.
content_type
!==
undefined
)
http_reply
.
header
[
'
Content-Type
'
]
=
att
.
content_type
;
http_reply
.
header
[
'
Content-Type
'
]
=
att
.
content_type
;
}
http_reply
.
header
[
'
Content-Length
'
]
=
att
.
body
.
length
;
http_reply
.
header
[
'
Content-Length
'
]
=
att
.
body
.
length
;
write
(
att
.
body
);
write
(
att
.
body
);
}
}
att
=
undefined
;
\ No newline at end of file
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