nomagick commited on
Commit
380bbff
·
unverified ·
1 Parent(s): ecb1af0

fix: formatting in some edge cases

Browse files
backend/functions/src/services/snapshot-formatter.ts CHANGED
@@ -208,9 +208,9 @@ export class SnapshotFormatter extends AsyncService {
208
  if (
209
  snapshot.maxElemDepth! > 256 ||
210
  (!uid && snapshot.elemCount! > 10_000) ||
211
- snapshot.elemCount! > 70_000
212
  ) {
213
- this.logger.warn('Degrading to text to protect the server', { url: snapshot.href });
214
  contentText = (snapshot.text || '').trimEnd();
215
  break;
216
  }
@@ -371,7 +371,7 @@ export class SnapshotFormatter extends AsyncService {
371
  }
372
  }
373
  }
374
- if (this.isPoorlyTransformed(contentText, toBeTurnedToMd)) {
375
  contentText = (snapshot.text || '').trimEnd();
376
  }
377
  } while (false);
 
208
  if (
209
  snapshot.maxElemDepth! > 256 ||
210
  (!uid && snapshot.elemCount! > 10_000) ||
211
+ snapshot.elemCount! > 80_000
212
  ) {
213
+ this.logger.warn('Degrading to text to protect the server', { url: snapshot.href, elemDepth: snapshot.maxElemDepth, elemCount: snapshot.elemCount });
214
  contentText = (snapshot.text || '').trimEnd();
215
  break;
216
  }
 
371
  }
372
  }
373
  }
374
+ if (mode === 'content' && this.isPoorlyTransformed(contentText, toBeTurnedToMd)) {
375
  contentText = (snapshot.text || '').trimEnd();
376
  }
377
  } while (false);