File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
packages/ghost/delete-record Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -108,10 +108,10 @@ export const getBaseSiteURL = (url) => {
108108 let siteLang ;
109109 if ( host . startsWith ( 'chinese' ) ) {
110110 siteLang = 'chinese' ;
111- } else if ( pathParts . length == = 3 ) {
111+ } else if ( pathParts . length > = 3 ) {
112112 // Webhooks will only be triggered by posts, so the path will
113- // always have 3 parts for our localized instances:
114- // (/<lang>/news/<slug>/).
113+ // always have 3-4 parts for our localized instances:
114+ // (/<lang>/news/<slug>/) or (/<lang>/news/<author>/<slug>/) .
115115 // Or if it's coming from a Dockerized test instance / localhost,
116116 // it will only have 1 part: (/<slug>/).
117117 siteLang = pathParts [ 0 ] ;
Original file line number Diff line number Diff line change @@ -18,15 +18,15 @@ export const deleteRecord = async (req) => {
1818
1919 // Whether a published post is unpublished or deleted, the
2020 // status will be 'published' in the previous state
21- if ( prevState . status === 'published' ) {
21+ if ( prevState ? .status === 'published' ) {
2222 // Deleted posts don't include a url or a primary author object.
2323 // But since every post returns an author array, we can use
2424 // the first author object to determine the search index name.
2525 // This helps since we're handling data from localhost,
2626 // chinese.freecodecamp.org, and www.freecodecamp.org.
27- const primaryAuthorURL = prevState . authors
28- ? prevState . authors [ 0 ] . url
29- : currState . authors [ 0 ] . url ;
27+ const primaryAuthorURL = prevState ? .authors
28+ ? prevState ? .authors [ 0 ] ? .url
29+ : currState ? .authors [ 0 ] ? .url ;
3030 const siteURL = getBaseSiteURL ( primaryAuthorURL ) ;
3131 const indexName = getSearchIndexName ( siteURL ) ;
3232
You can’t perform that action at this time.
0 commit comments