MCPcopy Create free account
hub / github.com/cfinke/Channel-Two / encodePathParts

Function encodePathParts

channel-two.js:1179–1196  ·  view source on GitHub ↗

* Encode the individual directories and filenames in a path without encoding the slashes.

( path )

Source from the content-addressed store, hash-verified

1177 * Encode the individual directories and filenames in a path without encoding the slashes.
1178 */
1179 function encodePathParts( path ) {
1180 let pathAndTime = path.split( '#t=' );
1181 let pathParts = pathAndTime[0].split( '/' );
1182 pathParts.forEach( function ( value, idx ) {
1183 pathParts[ idx ] = encodeURIComponent( value );
1184 } );
1185
1186 let returnValue = pathParts.join( '/' );
1187
1188 // If there was a timestamp, add it back in.
1189 if ( pathAndTime[1] ) {
1190 returnValue += '#t=' + pathAndTime[1];
1191 }
1192
1193 console.log( path + " encoded is " + returnValue );
1194
1195 return returnValue;
1196 }
1197
1198 /**
1199 * Decode the individual directories and filenames in a path without encoding the slashes.

Callers 2

playFunction · 0.85
addCaptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected