Skip to content

Commit

Permalink
fixed modpack filename with space in it breaking with serverstarter c…
Browse files Browse the repository at this point in the history
…ompat, potential fix for #18
  • Loading branch information
NielsPilgaard committed Jun 9, 2022
1 parent fd7d725 commit 079373b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions modpack-uploader.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ function New-ManifestJson {
$mods = [System.Collections.ArrayList]@()
foreach ($addon in $minecraftInstanceJson.installedAddons) {
$mods.Add(@{
required = $true
projectID = $addon.addonID
fileID = $addon.installedFile.id
required = $true
projectID = $addon.addonID
fileID = $addon.installedFile.id
downloadUrl = $addon.installedFile.downloadUrl
}) > $null
}
Expand Down Expand Up @@ -274,7 +274,9 @@ function Update-FileLinkInServerFiles {
$idPart1 = Remove-LeadingZero -text $idPart1
$idPart2 = $clientFileIdString.Substring(4, $clientFileIdString.length - 4)
$idPart2 = Remove-LeadingZero -text $idPart2
$curseForgeCdnUrl = "https://media.forgecdn.net/files/$idPart1/$idPart2/$CLIENT_ZIP_NAME.zip"
# CurseForge replaces whitespace in filenames with + in their CDN urls
$sanitizedClientZipName = $CLIENT_ZIP_NAME.Replace(" ", "+")
$curseForgeCdnUrl = "https://media.forgecdn.net/files/$idPart1/$idPart2/$sanitizedClientZipName.zip"
$content = (Get-Content -Path $SERVER_SETUP_CONFIG_PATH) -replace "https://media.forgecdn.net/files/\d+/\d+/.*.zip", $curseForgeCdnUrl
[System.IO.File]::WriteAllLines(($SERVER_SETUP_CONFIG_PATH | Resolve-Path), $content)

Expand Down

0 comments on commit 079373b

Please sign in to comment.