Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 3f783d5

Browse files
authored
Fix encoding of empty fields for RemotePostUpdateParametersWordPressComEncoder (#801)
2 parents ef18907 + 549fbee commit 3f783d5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Sources/WordPressKit/Models/RemotePostParameters.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ extension RemotePostCreateParameters {
9191
if (previous.content ?? "") != (content ?? "") {
9292
changes.content = (content ?? "")
9393
}
94-
if previous.password != password {
94+
if (previous.password ?? "") != (password ?? "") {
9595
changes.password = password
9696
}
9797
if (previous.excerpt ?? "") != (excerpt ?? "") {
@@ -289,11 +289,11 @@ struct RemotePostUpdateParametersWordPressComEncoder: Encodable {
289289
try container.encodeIfPresent(parameters.status, forKey: .status)
290290
try container.encodeIfPresent(parameters.date, forKey: .date)
291291
try container.encodeIfPresent(parameters.authorID, forKey: .authorID)
292-
try container.encodeIfPresent(parameters.title, forKey: .title)
293-
try container.encodeIfPresent(parameters.content, forKey: .content)
294-
try container.encodeIfPresent(parameters.password, forKey: .password)
295-
try container.encodeIfPresent(parameters.excerpt, forKey: .excerpt)
296-
try container.encodeIfPresent(parameters.slug, forKey: .slug)
292+
try container.encodeStringIfPresent(parameters.title, forKey: .title)
293+
try container.encodeStringIfPresent(parameters.content, forKey: .content)
294+
try container.encodeStringIfPresent(parameters.password, forKey: .password)
295+
try container.encodeStringIfPresent(parameters.excerpt, forKey: .excerpt)
296+
try container.encodeStringIfPresent(parameters.slug, forKey: .slug)
297297
if let value = parameters.featuredImageID {
298298
try container.encodeNullableID(value, forKey: .featuredImageID)
299299
}

0 commit comments

Comments
 (0)