Skip to content

Commit

Permalink
Make logging of disableCertificatePinning function less verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
niklashigi committed Jan 18, 2021
1 parent 5dcd08e commit 186d9c4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/tasks/disable-certificate-pinning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ export default async function disableCertificatePinning(
task: ListrTaskWrapper,
) {
return observeAsync(async next => {
next('Finding smali files...')

// Convert Windows path (using backslashes) to POSIX path (using slashes)
const directoryPathPosix = directoryPath
.split(path.sep)
Expand All @@ -51,12 +49,11 @@ export default async function disableCertificatePinning(

let pinningFound = false

next('Scanning Smali files...')
for await (const filePathChunk of globby.stream(globPattern)) {
// Required because Node.js streams are not typed as generics
const filePath = filePathChunk as string

next(`Scanning ${path.basename(filePath)}...`)

let originalContent = await fs.readFile(filePath, 'utf-8')

// Don't scan classes that don't implement the interface
Expand Down Expand Up @@ -104,6 +101,9 @@ export default async function disableCertificatePinning(
if (originalContent !== patchedContent) {
pinningFound = true

const relativePath = path.relative(directoryPath, filePath)
next(`Applied patch in "${relativePath}".`)

if (os.type() === 'Windows_NT') {
// Replace LF with CRLF again
patchedContent = patchedContent.replace(/\n/g, '\r\n')
Expand Down

0 comments on commit 186d9c4

Please sign in to comment.