Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
I
idrac-xml-replacer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
idrac-xml-replacer
Commits
73bfdaa1
Commit
73bfdaa1
authored
Jun 29, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix encoding
parent
2589090e
Pipeline
#198
failed with stages
in 41 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
server.ts
server.ts
+9
-3
No files found.
server.ts
View file @
73bfdaa1
...
...
@@ -8,7 +8,13 @@ const gzip: (b: Buffer) => Promise<Buffer> = util.promisify(zlib.gzip);
const
gunzip
:
(
b
:
Buffer
)
=>
Promise
<
Buffer
>
=
util
.
promisify
(
zlib
.
gunzip
);
const
xmlParser
=
new
xml
.
Parser
();
const
xmlBuilder
=
new
xml
.
Builder
();
const
xmlBuilder
=
new
xml
.
Builder
({
xmldec
:
{
version
:
'
1.0
'
,
encoding
:
'
utf-16
'
,
standalone
:
false
}
});
const
baseLocation
:
string
=
process
.
env
.
BASE_LOCATION
;
const
baseLocationAccessProtocols
:
string
=
process
.
env
.
PROTOCOL
||
"
HTTP
"
;
...
...
@@ -25,9 +31,9 @@ app.use('/', proxy("https://downloads.dell.com,", {
xmlObject
.
Manifest
.
$
.
baseLocation
=
baseLocation
;
xmlObject
.
Manifest
.
$
.
baseLocationAccessProtocols
=
baseLocationAccessProtocols
;
const
replaceContent
=
xmlBuilder
.
buildObject
(
xmlObject
);
return
await
gzip
(
Buffer
.
from
(
replaceContent
,
"
utf-8
"
));
return
await
gzip
(
iconv
.
encode
(
replaceContent
,
"
utf16
"
));
}
return
proxyResData
;
}
}));
app
.
listen
(
80
);
app
.
listen
(
80
80
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment