Skip to content

fix: tns preview warns incorrectly for exceeding file size limit #3954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/services/livesync/playground/preview-sdk-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PubnubKeys } from "./preview-app-constants";
const pako = require("pako");

export class PreviewSdkService implements IPreviewSdkService {
private static MAX_FILES_UPLOAD_BYTE_LENGTH = 30000;
private static MAX_FILES_UPLOAD_BYTE_LENGTH = 15 * 1024 * 1024; // In MBs
private messagingService: MessagingService = null;
private instanceId: string = null;
public connectedDevices: Device[] = [];
Expand Down Expand Up @@ -76,7 +76,8 @@ export class PreviewSdkService implements IPreviewSdkService {
onSendingChange: (sending: boolean) => ({ }),
onBiggerFilesUpload: async (filesContent, callback) => {
const gzippedContent = Buffer.from(pako.gzip(filesContent));
const byteLength = gzippedContent.byteLength;
const byteLength = filesContent.length;

if (byteLength > PreviewSdkService.MAX_FILES_UPLOAD_BYTE_LENGTH) {
this.$logger.warn("The files to upload exceed the maximum allowed size of 15MB. Your app might not work as expected.");
}
Expand Down