From 46a3c087054b70182a70c7b9da98ef598afa85ad Mon Sep 17 00:00:00 2001 From: Christopher Cook Date: Tue, 10 Dec 2024 17:43:05 +0800 Subject: [PATCH] Fix identifier as path for cases where file starts with con. causing failures --- .../ACME/Anvil/AnvilACMEProvider.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Certify.Providers/ACME/Anvil/AnvilACMEProvider.cs b/src/Certify.Providers/ACME/Anvil/AnvilACMEProvider.cs index 8b2565ee9..f0b455854 100644 --- a/src/Certify.Providers/ACME/Anvil/AnvilACMEProvider.cs +++ b/src/Certify.Providers/ACME/Anvil/AnvilACMEProvider.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Globalization; @@ -1672,7 +1672,18 @@ public async Task CompleteCertificateRequest(ILog log, Manage }; } - private string GetIdentifierAsPath(string identifier) => identifier?.Replace("*", "_") ?? ""; + private string GetIdentifierAsPath(string identifier) + { + var path = identifier?.Replace("*", "_") ?? ""; + + if (path.StartsWith("con.")) + { + // on some versions of windows creating a path with a con. prefix fails. + path = path.Replace("con.", "_con."); + } + + return path; + } private string GetPrimaryIdentifierAsPath(CertRequestConfig config, string internalId) => GetIdentifierAsPath(string.IsNullOrEmpty(config.PrimaryDomain) ? internalId : config.PrimaryDomain);