Skip to content

Commit

Permalink
Fix encoding of empty fields for RemotePostUpdateParametersWordPressC…
Browse files Browse the repository at this point in the history
…omEncoder (#801)
  • Loading branch information
kean authored May 7, 2024
2 parents ef18907 + 549fbee commit 3f783d5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Sources/WordPressKit/Models/RemotePostParameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ extension RemotePostCreateParameters {
if (previous.content ?? "") != (content ?? "") {
changes.content = (content ?? "")
}
if previous.password != password {
if (previous.password ?? "") != (password ?? "") {
changes.password = password
}
if (previous.excerpt ?? "") != (excerpt ?? "") {
Expand Down Expand Up @@ -289,11 +289,11 @@ struct RemotePostUpdateParametersWordPressComEncoder: Encodable {
try container.encodeIfPresent(parameters.status, forKey: .status)
try container.encodeIfPresent(parameters.date, forKey: .date)
try container.encodeIfPresent(parameters.authorID, forKey: .authorID)
try container.encodeIfPresent(parameters.title, forKey: .title)
try container.encodeIfPresent(parameters.content, forKey: .content)
try container.encodeIfPresent(parameters.password, forKey: .password)
try container.encodeIfPresent(parameters.excerpt, forKey: .excerpt)
try container.encodeIfPresent(parameters.slug, forKey: .slug)
try container.encodeStringIfPresent(parameters.title, forKey: .title)
try container.encodeStringIfPresent(parameters.content, forKey: .content)
try container.encodeStringIfPresent(parameters.password, forKey: .password)
try container.encodeStringIfPresent(parameters.excerpt, forKey: .excerpt)
try container.encodeStringIfPresent(parameters.slug, forKey: .slug)
if let value = parameters.featuredImageID {
try container.encodeNullableID(value, forKey: .featuredImageID)
}
Expand Down

0 comments on commit 3f783d5

Please sign in to comment.