@@ -1739,12 +1739,11 @@ exports.HashDiff = HashDiff;
1739
1739
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
1740
1740
exports . prettyError = void 0 ;
1741
1741
const types_1 = __webpack_require__ ( 6703 ) ;
1742
- function outputOriginalErrorAndExit ( logger , error ) {
1742
+ function logOriginalError ( logger , error ) {
1743
1743
logger . all ( ) ;
1744
1744
logger . all ( `----------------------------------------------------------------` ) ;
1745
1745
logger . all ( `---------------------- Full Error below ----------------------` ) ;
1746
1746
logger . all ( error ) ;
1747
- process . exit ( ) ;
1748
1747
}
1749
1748
/**
1750
1749
* Converts a exception to helpful debug info
@@ -1755,41 +1754,36 @@ function prettyError(logger, args, error) {
1755
1754
logger . all ( `----------------------------------------------------------------` ) ;
1756
1755
logger . all ( `--------------- 🔥🔥🔥 A error occurred 🔥🔥🔥 --------------` ) ;
1757
1756
logger . all ( `----------------------------------------------------------------` ) ;
1757
+ const ftpError = error ;
1758
1758
if ( typeof error . code === "string" ) {
1759
1759
const errorCode = error . code ;
1760
1760
if ( errorCode === "ENOTFOUND" ) {
1761
1761
logger . all ( `The server "${ args . server } " doesn't seem to exist. Do you have a typo?` ) ;
1762
- outputOriginalErrorAndExit ( logger , error ) ;
1763
1762
}
1764
1763
}
1765
- if ( typeof error . name === "string" ) {
1764
+ else if ( typeof error . name === "string" ) {
1766
1765
const errorName = error . name ;
1767
1766
if ( errorName . includes ( "ERR_TLS_CERT_ALTNAME_INVALID" ) ) {
1768
1767
logger . all ( `The certificate for "${ args . server } " is likely shared. The host did not place your server on the list of valid domains for this cert.` ) ;
1769
1768
logger . all ( `This is a common issue with shared hosts. You have a few options:` ) ;
1770
1769
logger . all ( ` - Ignore this error by setting security back to loose` ) ;
1771
1770
logger . all ( ` - Contact your hosting provider and ask them for your servers hostname` ) ;
1772
- outputOriginalErrorAndExit ( logger , error ) ;
1773
1771
}
1774
1772
}
1775
- const ftpError = error ;
1776
- if ( typeof ftpError . code === "number" ) {
1773
+ else if ( typeof ftpError . code === "number" ) {
1777
1774
if ( ftpError . code === types_1 . ErrorCode . NotLoggedIn ) {
1778
1775
const serverRequiresFTPS = ftpError . message . toLowerCase ( ) . includes ( "must use encryption" ) ;
1779
1776
if ( serverRequiresFTPS ) {
1780
1777
logger . all ( `The server you are connecting to requires encryption (ftps)` ) ;
1781
1778
logger . all ( `Enable FTPS by using the protocol option.` ) ;
1782
- outputOriginalErrorAndExit ( logger , error ) ;
1783
1779
}
1784
1780
else {
1785
1781
logger . all ( `Could not login with the username "${ args . username } " and password "${ args . password } ".` ) ;
1786
1782
logger . all ( `Make sure you can login with those credentials. If you have a space or a quote in your username or password be sure to escape them!` ) ;
1787
- outputOriginalErrorAndExit ( logger , error ) ;
1788
1783
}
1789
1784
}
1790
1785
}
1791
- // unknown error :(
1792
- outputOriginalErrorAndExit ( logger , error ) ;
1786
+ logOriginalError ( logger , error ) ;
1793
1787
}
1794
1788
exports . prettyError = prettyError ;
1795
1789
@@ -1833,7 +1827,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
1833
1827
return ( mod && mod . __esModule ) ? mod : { "default" : mod } ;
1834
1828
} ;
1835
1829
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
1836
- exports . deploy = exports . excludeDefaults = void 0 ;
1830
+ exports . deploy = exports . getLocalFiles = exports . excludeDefaults = void 0 ;
1837
1831
const ftp = __importStar ( __webpack_require__ ( 7957 ) ) ;
1838
1832
const readdir_enhanced_1 = __importDefault ( __webpack_require__ ( 8811 ) ) ;
1839
1833
const crypto_1 = __importDefault ( __webpack_require__ ( 6417 ) ) ;
@@ -1902,7 +1896,7 @@ function getLocalFiles(args) {
1902
1896
type : "file" ,
1903
1897
name : stat . path ,
1904
1898
size : stat . size ,
1905
- hash : yield fileHash ( stat . path , "sha256" )
1899
+ hash : yield fileHash ( args [ "local-dir" ] + stat . path , "sha256" )
1906
1900
} ) ;
1907
1901
continue ;
1908
1902
}
@@ -1912,12 +1906,13 @@ function getLocalFiles(args) {
1912
1906
}
1913
1907
return {
1914
1908
description : types_1 . syncFileDescription ,
1915
- version : types_1 . currentVersion ,
1909
+ version : types_1 . currentSyncFileVersion ,
1916
1910
generatedTime : new Date ( ) . getTime ( ) ,
1917
1911
data : records
1918
1912
} ;
1919
1913
} ) ;
1920
1914
}
1915
+ exports . getLocalFiles = getLocalFiles ;
1921
1916
function downloadFileList ( client , logger , path ) {
1922
1917
return __awaiter ( this , void 0 , void 0 , function * ( ) {
1923
1918
// note: originally this was using a writable stream instead of a buffer file
@@ -2116,7 +2111,7 @@ function getServerFiles(client, logger, timings, args) {
2116
2111
// set the server state to nothing, because we don't know what the server state is
2117
2112
return {
2118
2113
description : types_1 . syncFileDescription ,
2119
- version : types_1 . currentVersion ,
2114
+ version : types_1 . currentSyncFileVersion ,
2120
2115
generatedTime : new Date ( ) . getTime ( ) ,
2121
2116
data : [ ] ,
2122
2117
} ;
@@ -2194,7 +2189,7 @@ function deploy(deployArgs) {
2194
2189
// header
2195
2190
// todo allow swapping out library/version text based on if we are using action
2196
2191
logger . all ( `----------------------------------------------------------------` ) ;
2197
- logger . all ( `🚀 Thanks for using ftp-deploy version ${ types_1 . currentVersion } . Let's deploy some stuff! ` ) ;
2192
+ logger . all ( `🚀 Thanks for using ftp-deploy version ${ types_1 . currentSyncFileVersion } . Let's deploy some stuff! ` ) ;
2198
2193
logger . all ( `----------------------------------------------------------------` ) ;
2199
2194
logger . all ( `If you found this project helpful, please support it` ) ;
2200
2195
logger . all ( `by giving it a ⭐ on Github --> https://github.com/SamKirkland/FTP-Deploy-Action` ) ;
@@ -2216,8 +2211,10 @@ function deploy(deployArgs) {
2216
2211
yield global . reconnect ( ) ;
2217
2212
try {
2218
2213
const serverFiles = yield getServerFiles ( client , logger , timings , args ) ;
2214
+ timings . start ( "logging" ) ;
2219
2215
const diffTool = new HashDiff_1 . HashDiff ( ) ;
2220
2216
const diffs = diffTool . getDiffs ( localFiles , serverFiles , logger ) ;
2217
+ timings . stop ( "logging" ) ;
2221
2218
totalBytesUploaded = diffs . sizeUpload + diffs . sizeReplace ;
2222
2219
timings . start ( "upload" ) ;
2223
2220
try {
@@ -2226,11 +2223,9 @@ function deploy(deployArgs) {
2226
2223
catch ( e ) {
2227
2224
if ( e . code === types_1 . ErrorCode . FileNameNotAllowed ) {
2228
2225
logger . all ( "Error 553 FileNameNotAllowed, you don't have access to upload that file" ) ;
2229
- logger . all ( e ) ;
2230
- process . exit ( ) ;
2231
2226
}
2232
2227
logger . all ( e ) ;
2233
- process . exit ( ) ;
2228
+ throw e ;
2234
2229
}
2235
2230
finally {
2236
2231
timings . stop ( "upload" ) ;
@@ -2246,6 +2241,7 @@ function deploy(deployArgs) {
2246
2241
}
2247
2242
catch ( error ) {
2248
2243
errorHandling_1 . prettyError ( logger , args , error ) ;
2244
+ throw error ;
2249
2245
}
2250
2246
finally {
2251
2247
client . close ( ) ;
@@ -2258,6 +2254,7 @@ function deploy(deployArgs) {
2258
2254
logger . all ( `Time spent connecting to server: ${ timings . getTimeFormatted ( "connecting" ) } ` ) ;
2259
2255
logger . all ( `Time spent deploying: ${ timings . getTimeFormatted ( "upload" ) } (${ uploadSpeed } /second)` ) ;
2260
2256
logger . all ( ` - changing dirs: ${ timings . getTimeFormatted ( "changingDir" ) } ` ) ;
2257
+ logger . all ( ` - logging: ${ timings . getTimeFormatted ( "logging" ) } ` ) ;
2261
2258
logger . all ( `----------------------------------------------------------------` ) ;
2262
2259
logger . all ( `Total time: ${ timings . getTimeFormatted ( "total" ) } ` ) ;
2263
2260
logger . all ( `----------------------------------------------------------------` ) ;
@@ -2274,8 +2271,8 @@ exports.deploy = deploy;
2274
2271
"use strict" ;
2275
2272
2276
2273
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
2277
- exports . ErrorCode = exports . syncFileDescription = exports . currentVersion = void 0 ;
2278
- exports . currentVersion = "1.0.0" ;
2274
+ exports . ErrorCode = exports . syncFileDescription = exports . currentSyncFileVersion = void 0 ;
2275
+ exports . currentSyncFileVersion = "1.0.0" ;
2279
2276
exports . syncFileDescription = "DO NOT DELETE THIS FILE. This file is used to keep track of which files have been synced in the most recent deployment. If you delete this file a resync will need to be done (which can take a while) - read more: https://github.com/SamKirkland/FTP-Deploy-Action" ;
2280
2277
var ErrorCode ;
2281
2278
( function ( ErrorCode ) {
@@ -3303,12 +3300,8 @@ class Client {
3303
3300
return res ;
3304
3301
}
3305
3302
catch ( err ) {
3306
- // Receiving an FTPError means that the last transfer strategy failed and we should
3307
- // try the next one. Any other exception should stop the evaluation of strategies because
3308
- // something else went wrong.
3309
- if ( ! ( err instanceof FtpContext_1 . FTPError ) ) {
3310
- throw err ;
3311
- }
3303
+ // Try the next candidate no matter the exact error. It's possible that a server
3304
+ // answered incorrectly to a strategy, for example a PASV answer to an EPSV.
3312
3305
}
3313
3306
}
3314
3307
throw new Error ( "None of the available transfer strategies work." ) ;
@@ -3970,9 +3963,10 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
3970
3963
o [ k2 ] = m [ k ] ;
3971
3964
} ) ) ;
3972
3965
var __exportStar = ( this && this . __exportStar ) || function ( m , exports ) {
3973
- for ( var p in m ) if ( p !== "default" && ! exports . hasOwnProperty ( p ) ) __createBinding ( exports , m , p ) ;
3966
+ for ( var p in m ) if ( p !== "default" && ! Object . prototype . hasOwnProperty . call ( exports , p ) ) __createBinding ( exports , m , p ) ;
3974
3967
} ;
3975
3968
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
3969
+ exports . enterPassiveModeIPv6 = exports . enterPassiveModeIPv4 = void 0 ;
3976
3970
/**
3977
3971
* Public API
3978
3972
*/
@@ -4131,7 +4125,7 @@ function positiveIntermediate(code) {
4131
4125
}
4132
4126
exports . positiveIntermediate = positiveIntermediate ;
4133
4127
function isNotBlank ( str ) {
4134
- return str !== "" ;
4128
+ return str . trim ( ) !== "" ;
4135
4129
}
4136
4130
4137
4131
@@ -4157,7 +4151,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
4157
4151
var __importStar = ( this && this . __importStar ) || function ( mod ) {
4158
4152
if ( mod && mod . __esModule ) return mod ;
4159
4153
var result = { } ;
4160
- if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . hasOwnProperty . call ( mod , k ) ) __createBinding ( result , mod , k ) ;
4154
+ if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype . hasOwnProperty . call ( mod , k ) ) __createBinding ( result , mod , k ) ;
4161
4155
__setModuleDefault ( result , mod ) ;
4162
4156
return result ;
4163
4157
} ;
@@ -6655,11 +6649,12 @@ function optionalInt(argumentName, rawValue) {
6655
6649
core . setFailed ( `${ argumentName } : invalid parameter - you provided "${ rawValue } ". Try a whole number (no decimals) instead like 1234` ) ;
6656
6650
}
6657
6651
function optionalStringArray ( argumentName , rawValue ) {
6652
+ console . log ( rawValue ) ;
6658
6653
if ( rawValue . length === 0 ) {
6659
6654
return undefined ;
6660
6655
}
6661
6656
// split value by space and comma
6662
- return rawValue . split ( ", " ) ;
6657
+ return rawValue . split ( "\n" ) . filter ( str => str !== " ") ;
6663
6658
}
6664
6659
6665
6660
0 commit comments