mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2025-01-31 04:21:40 +01:00
chore: update how the body limit is applied
This commit is contained in:
parent
8d45e52ab7
commit
791e11e0c8
@ -40,17 +40,15 @@ task discordupload {
|
||||
"${getReleaseChangelog()}\n"
|
||||
|
||||
if (content.length() > maxLength) {
|
||||
def afterMessage = "[See more on GitHub](https://github.com/sekwah41/Advanced-Portals/releases)"
|
||||
def afterMessage = "[See more on GitHub](<https://github.com/sekwah41/Advanced-Portals/releases>)"
|
||||
|
||||
def truncatedContent = content.take(maxLength - afterMessage.length() - 1)
|
||||
def truncatedContent = content.replaceAll(/(http[s]?:\/\/[^\s)]+)/, '<$1>').take(maxLength - afterMessage.length() - 1)
|
||||
def lastFullLine = truncatedContent.lastIndexOf("\n")
|
||||
content = "${truncatedContent.take(lastFullLine)}\n" +
|
||||
"${afterMessage}"
|
||||
content = "${truncatedContent.take(lastFullLine)}\n"
|
||||
content += afterMessage
|
||||
|
||||
}
|
||||
|
||||
content = content.replaceAll(/(http[s]?:\/\/[^\s)]+)/, '<$1>')
|
||||
|
||||
builder.addTextBody("content", content, ContentType.create("text/plain", "UTF-8"))
|
||||
}
|
||||
|
||||
@ -63,7 +61,15 @@ task discordupload {
|
||||
response.getEntity()
|
||||
|
||||
if(response.getStatusLine().getStatusCode() != 200) {
|
||||
throw new RuntimeException("Failed to post build to discord")
|
||||
println("Failed to post build to Discord.")
|
||||
println("Status Code: " + response.getStatusLine().getStatusCode())
|
||||
println("Reason Phrase: " + response.getStatusLine().getReasonPhrase())
|
||||
|
||||
String responseContent = response.getEntity() != null ?
|
||||
org.apache.http.util.EntityUtils.toString(response.getEntity()) : "No content"
|
||||
println("Response Content: " + responseContent)
|
||||
|
||||
throw new RuntimeException("Failed to post build to Discord")
|
||||
}
|
||||
|
||||
println("Posted build")
|
||||
|
Loading…
Reference in New Issue
Block a user