Skip to content

Commit 92b7b06

Browse files
Merge pull request #3954 from NativeScript/vladimirov/fix-preview-check-files
fix: tns preview warns incorrectly for exceeding file size limit
2 parents 6167820 + fc39950 commit 92b7b06

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/services/livesync/playground/preview-sdk-service.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { PubnubKeys } from "./preview-app-constants";
33
const pako = require("pako");
44

55
export class PreviewSdkService implements IPreviewSdkService {
6-
private static MAX_FILES_UPLOAD_BYTE_LENGTH = 30000;
6+
private static MAX_FILES_UPLOAD_BYTE_LENGTH = 15 * 1024 * 1024; // In MBs
77
private messagingService: MessagingService = null;
88
private instanceId: string = null;
99
public connectedDevices: Device[] = [];
@@ -76,7 +76,8 @@ export class PreviewSdkService implements IPreviewSdkService {
7676
onSendingChange: (sending: boolean) => ({ }),
7777
onBiggerFilesUpload: async (filesContent, callback) => {
7878
const gzippedContent = Buffer.from(pako.gzip(filesContent));
79-
const byteLength = gzippedContent.byteLength;
79+
const byteLength = filesContent.length;
80+
8081
if (byteLength > PreviewSdkService.MAX_FILES_UPLOAD_BYTE_LENGTH) {
8182
this.$logger.warn("The files to upload exceed the maximum allowed size of 15MB. Your app might not work as expected.");
8283
}

0 commit comments

Comments
 (0)