Skip to content

Commit 44e0e0d

Browse files
fixed uuencode
1 parent 3141cd3 commit 44e0e0d

File tree

10 files changed

+63
-29
lines changed

10 files changed

+63
-29
lines changed

cjs/base-ex.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@ class UUencode extends BaseTemplate {
21272127

21282128
// repeatedly take 60 chars from the output until it is empty
21292129
for (;;) {
2130-
const lArray = outArray.splice(0, 60).split(/\r?\n/);
2130+
const lArray = outArray.splice(0, 60);
21312131

21322132
// if all chars are taken, remove eventually added pad zeros
21332133
if (!outArray.length) {
@@ -2193,7 +2193,7 @@ class UUencode extends BaseTemplate {
21932193
break;
21942194
}
21952195

2196-
// fix missing spaces for original charset
2196+
// fix probably missing spaces for original charset
21972197
else if (lArray.length !== 60 && settings.version === "original") {
21982198
while (inArray.length % 60) {
21992199
inArray.push(" ");

cjs/base-ex.cjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/base-ex.esm.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2053,13 +2053,14 @@ class Base64 extends BaseTemplate {
20532053
* BaseEx UUencode Converter.
20542054
* ------------------------
20552055
*
2056-
* This is a base64 converter. Various input can be
2057-
* converted to a base64 string or a base64 string
2056+
* This is a UUencoder/UUdecoder. Various input can be
2057+
* converted to a UUencoded string or a UUencoded string
20582058
* can be decoded into various formats.
20592059
*
20602060
* Available charsets are:
20612061
* - default
2062-
* - urlsafe
2062+
* - original
2063+
* - xx
20632064
*/
20642065
class UUencode extends BaseTemplate {
20652066

@@ -2168,7 +2169,7 @@ class UUencode extends BaseTemplate {
21682169
const format = ({ input, settings }) => {
21692170

21702171
const charset = this.charsets[settings.version];
2171-
const lines = input.trim().split("\n");
2172+
const lines = input.trim().split(/\r?\n/);
21722173
const inArray = [];
21732174

21742175
if ((/^begin/i).test(lines.at(0))) {
@@ -2185,10 +2186,17 @@ class UUencode extends BaseTemplate {
21852186

21862187
inArray.push(...lArray);
21872188

2188-
if (byteCount !== 45) {
2189+
if (byteCount !== 45) {
21892190
padChars = this.converter.padChars(lArray.length) - byteCount;
21902191
break;
21912192
}
2193+
2194+
// fix probably missing spaces for original charset
2195+
else if (lArray.length !== 60 && settings.version === "original") {
2196+
while (inArray.length % 60) {
2197+
inArray.push(" ");
2198+
}
2199+
}
21922200
}
21932201

21942202
return inArray.join("");
@@ -3894,6 +3902,7 @@ class BaseEx {
38943902
this.base64 = new Base64("default", outputType);
38953903
this.base64_urlsafe = new Base64("urlsafe", outputType);
38963904
this.uuencode = new UUencode("default", outputType);
3905+
this.uuencode_original = new UUencode("original", outputType);
38973906
this.xxencode = new UUencode("xx", outputType);
38983907
this.base85_adobe = new Base85("adobe", outputType);
38993908
this.base85_ascii = new Base85("ascii85", outputType);

dist/base-ex.esm.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/base-ex.iife.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,13 +2056,14 @@ var BaseEx = (function (exports) {
20562056
* BaseEx UUencode Converter.
20572057
* ------------------------
20582058
*
2059-
* This is a base64 converter. Various input can be
2060-
* converted to a base64 string or a base64 string
2059+
* This is a UUencoder/UUdecoder. Various input can be
2060+
* converted to a UUencoded string or a UUencoded string
20612061
* can be decoded into various formats.
20622062
*
20632063
* Available charsets are:
20642064
* - default
2065-
* - urlsafe
2065+
* - original
2066+
* - xx
20662067
*/
20672068
class UUencode extends BaseTemplate {
20682069

@@ -2171,7 +2172,7 @@ var BaseEx = (function (exports) {
21712172
const format = ({ input, settings }) => {
21722173

21732174
const charset = this.charsets[settings.version];
2174-
const lines = input.trim().split("\n");
2175+
const lines = input.trim().split(/\r?\n/);
21752176
const inArray = [];
21762177

21772178
if ((/^begin/i).test(lines.at(0))) {
@@ -2188,10 +2189,17 @@ var BaseEx = (function (exports) {
21882189

21892190
inArray.push(...lArray);
21902191

2191-
if (byteCount !== 45) {
2192+
if (byteCount !== 45) {
21922193
padChars = this.converter.padChars(lArray.length) - byteCount;
21932194
break;
21942195
}
2196+
2197+
// fix probably missing spaces for original charset
2198+
else if (lArray.length !== 60 && settings.version === "original") {
2199+
while (inArray.length % 60) {
2200+
inArray.push(" ");
2201+
}
2202+
}
21952203
}
21962204

21972205
return inArray.join("");
@@ -3897,6 +3905,7 @@ var BaseEx = (function (exports) {
38973905
this.base64 = new Base64("default", outputType);
38983906
this.base64_urlsafe = new Base64("urlsafe", outputType);
38993907
this.uuencode = new UUencode("default", outputType);
3908+
this.uuencode_original = new UUencode("original", outputType);
39003909
this.xxencode = new UUencode("xx", outputType);
39013910
this.base85_adobe = new Base85("adobe", outputType);
39023911
this.base85_ascii = new Base85("ascii85", outputType);

dist/base-ex.iife.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/converters/UUencode/uuencode.esm.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,13 +1461,14 @@ class BaseTemplate {
14611461
* BaseEx UUencode Converter.
14621462
* ------------------------
14631463
*
1464-
* This is a base64 converter. Various input can be
1465-
* converted to a base64 string or a base64 string
1464+
* This is a UUencoder/UUdecoder. Various input can be
1465+
* converted to a UUencoded string or a UUencoded string
14661466
* can be decoded into various formats.
14671467
*
14681468
* Available charsets are:
14691469
* - default
1470-
* - urlsafe
1470+
* - original
1471+
* - xx
14711472
*/
14721473
class UUencode extends BaseTemplate {
14731474

@@ -1576,7 +1577,7 @@ class UUencode extends BaseTemplate {
15761577
const format = ({ input, settings }) => {
15771578

15781579
const charset = this.charsets[settings.version];
1579-
const lines = input.trim().split("\n");
1580+
const lines = input.trim().split(/\r?\n/);
15801581
const inArray = [];
15811582

15821583
if ((/^begin/i).test(lines.at(0))) {
@@ -1593,10 +1594,17 @@ class UUencode extends BaseTemplate {
15931594

15941595
inArray.push(...lArray);
15951596

1596-
if (byteCount !== 45) {
1597+
if (byteCount !== 45) {
15971598
padChars = this.converter.padChars(lArray.length) - byteCount;
15981599
break;
15991600
}
1601+
1602+
// fix probably missing spaces for original charset
1603+
else if (lArray.length !== 60 && settings.version === "original") {
1604+
while (inArray.length % 60) {
1605+
inArray.push(" ");
1606+
}
1607+
}
16001608
}
16011609

16021610
return inArray.join("");

dist/converters/UUencode/uuencode.esm.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/converters/UUencode/uuencode.iife.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,13 +1464,14 @@ var UUencode = (function () {
14641464
* BaseEx UUencode Converter.
14651465
* ------------------------
14661466
*
1467-
* This is a base64 converter. Various input can be
1468-
* converted to a base64 string or a base64 string
1467+
* This is a UUencoder/UUdecoder. Various input can be
1468+
* converted to a UUencoded string or a UUencoded string
14691469
* can be decoded into various formats.
14701470
*
14711471
* Available charsets are:
14721472
* - default
1473-
* - urlsafe
1473+
* - original
1474+
* - xx
14741475
*/
14751476
class UUencode extends BaseTemplate {
14761477

@@ -1579,7 +1580,7 @@ var UUencode = (function () {
15791580
const format = ({ input, settings }) => {
15801581

15811582
const charset = this.charsets[settings.version];
1582-
const lines = input.trim().split("\n");
1583+
const lines = input.trim().split(/\r?\n/);
15831584
const inArray = [];
15841585

15851586
if ((/^begin/i).test(lines.at(0))) {
@@ -1596,10 +1597,17 @@ var UUencode = (function () {
15961597

15971598
inArray.push(...lArray);
15981599

1599-
if (byteCount !== 45) {
1600+
if (byteCount !== 45) {
16001601
padChars = this.converter.padChars(lArray.length) - byteCount;
16011602
break;
16021603
}
1604+
1605+
// fix probably missing spaces for original charset
1606+
else if (lArray.length !== 60 && settings.version === "original") {
1607+
while (inArray.length % 60) {
1608+
inArray.push(" ");
1609+
}
1610+
}
16031611
}
16041612

16051613
return inArray.join("");

dist/converters/UUencode/uuencode.iife.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)