Merge pull request #5289 from arnaud-jacquemin/staging

Fix #5272 Instagram import fails silently if there's one post only in posts_1.json
This commit is contained in:
daniel 2024-09-17 02:59:54 -06:00 committed by GitHub
commit 0ddab939ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -369,6 +369,10 @@
async filterPostMeta(media) { async filterPostMeta(media) {
let fbfix = await this.fixFacebookEncoding(media); let fbfix = await this.fixFacebookEncoding(media);
let json = JSON.parse(fbfix); let json = JSON.parse(fbfix);
/* Sometimes the JSON isn't an array, when there's only one post */
if (!Array.isArray(json)) {
json = new Array(json);
}
let res = json.filter(j => { let res = json.filter(j => {
let ids = j.media.map(m => m.uri).filter(m => { let ids = j.media.map(m => m.uri).filter(m => {
if(this.config.allow_video_posts == true) { if(this.config.allow_video_posts == true) {