Skip to content

Commit

Permalink
Fix --certificate only working with .pem files
Browse files Browse the repository at this point in the history
Fixes #146
  • Loading branch information
niklashigi committed Apr 21, 2024
1 parent ce83872 commit 51578b4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/tasks/create-netsec-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ const generateConfig = ({

/** Generates the XML block responsible for registering a custom certificate. */
const generateCertificateBlock = (path: string) => {
const fileName = pathUtils.basename(path, '.pem')
const fileName = pathUtils.basename(path)

// Android resources are always referred to without their file extension
const resourceName = fileName.replace(/\.[a-z\d]+$/, '')

return `\n
<!-- Allow specific certificate -->
<certificates src="@raw/${fileName}" />\n`
<certificates src="@raw/${resourceName}" />\n`
}

export default async function createNetworkSecurityConfig(
Expand Down

0 comments on commit 51578b4

Please sign in to comment.