Skip to content

Commit ca54d1a

Browse files
authored
Merge pull request #531 from NickAllmakerOpsCompass/fix_fileattr
Fixing preserving linux file permissions
2 parents b148463 + 3e2fa32 commit ca54d1a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

headers/entryHeader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ module.exports = function () {
183183

184184
// get Unix file permissions
185185
get fileAttr() {
186-
return uint16(_attr >> 16) & 0xfff;
186+
return (_attr || 0) >> 16 & 0xfff;
187187
},
188188

189189
get offset() {

test/header.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,16 @@ describe("headers", () => {
142142
expect(head.toJSON()).to.eql(headerdata);
143143
});
144144

145+
it("handles fileAttr when attr above 0x80000000", () => {
146+
const attr = 0x81E80000;
147+
148+
const head = new centralHeader();
149+
head.loadFromBinary(readBuf);
150+
head.attr = attr;
151+
152+
expect(head.fileAttr).to.equal(0x01E8);
153+
});
154+
145155
it("read binary and create new binary from it, they have to be equal", () => {
146156
const head = new centralHeader();
147157
head.loadFromBinary(readBuf);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy