Primal Script intermittently corrupts files during transfer

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 1 year and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
pa_cle
Posts: 12
Last visit: Mon Jun 22, 2026 6:19 am
Answers: 0

Primal Script intermittently corrupts files during transfer

Post by pa_cle »

Product, version and build:Primal Script Version 8.1.212.0
Operating system:Windows 11 64 Bit
PowerShell version(s):

We are having an issue with several workstations after upgrading them to Windows 11 and Primal Script 2025. When we use FTP to publish to our development servers, which have been have been in service for many years now with our staff using Primal Script as our primary publishing tool. After the upgrade we had no issues and it seems that sometime in mid December we began to experience an issue were the upload option in Primal Script would connect and perform the upload but would corrupt the file it was uploading to the web site. How it corrupts the file is not consistent in that it can strip 200 lines or 10 line either at the front of the file or the end. We are able to perform the upload successfully with Filezilla using the same information we are providing the Transfer settings in Primal Script.
User avatar
Alexander Riedel
Posts: 859
Last visit: Wed Jul 01, 2026 9:50 am
Answers: 10
Been upvoted: 49 times

Re: Primal Script intermittently corrupts files during transfer

Post by Alexander Riedel »

Oh that is horrible to hear. The FTP code has not changed in ages, so at this moment I am not sure how this can happen.
Are you opening and saving the file directly from and to the FTP server or are you using FTP-Put on the 'Connect" tab?
Please also indicate what type of file and its encoding. I cannot say of that is a factor but I want to leave no stone unturned.
Would it be possible for you to zip and upload a intact and a corrupted file here: https://www.sapien.com/support/upload ?
What type of FTP server on what platform are you running? I am aware you say they existed for years, but I still would like to look into that as well, just to be thorough.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
pa_cle
Posts: 12
Last visit: Mon Jun 22, 2026 6:19 am
Answers: 0

Re: Primal Script intermittently corrupts files during transfer

Post by pa_cle »

We are using the upload feature in PrimalScript ... right click the file and select 'upload'. We have the FTP settings in the 'settings' under project.
The file is a plain text file
file extension = ".php" created from PrimalScript
It is the windows FTP server in IIS on Windows 2016 Server - Version 1607 - (OS Build 4393-7606)
If there is additional information you need let us know and we will gather it.
User avatar
Alexander Riedel
Posts: 859
Last visit: Wed Jul 01, 2026 9:50 am
Answers: 10
Been upvoted: 49 times

Re: Primal Script intermittently corrupts files during transfer

Post by Alexander Riedel »

Thank you for sending the files. The corrupt file ends exactly at 1024 bytes (1K) which is the buffer size the FTP transfer uses.
According to the code, it would only stop sending if the next read from the file would receive an end-of-file or a byte count of zero.
The uncorrupted test file completed transfers up and down without fail in my test here, but you indicated this is intermittent.

The two questions I have to investigate this further are:

1. Do you get any error message along the way when a file gets cut off or otherwise? The underlying Windows API would throw an exception
if anything undue were to happen and that would result in a message box with an error code. If so, please provide an image or the error in that message.

2. Is it at all possible that some other process is potentially opening, modifying or saving that file while it is being transferred? This can be an autosave, even in PrimalScript,
some backup tool, version control, someone else editing that file if it is on a server or network location. Anything.

While waiting for your reply I will investigate if there any changes in the underlying API and shore up some potential interference from other processes. These changes should be in the next build. But since this has not ever happened before I can of course not be certain I am barking up the right tree here.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Alexander Riedel
Posts: 859
Last visit: Wed Jul 01, 2026 9:50 am
Answers: 10
Been upvoted: 49 times

Re: Primal Script intermittently corrupts files during transfer

Post by Alexander Riedel »

A new PrimalScript build (8.1.214) was released today, which contains some additional checks for failing ftp up- or downloads.
I would recommend trying that and checking if it produces any additional error messages and under what conditions.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
pa_cle
Posts: 12
Last visit: Mon Jun 22, 2026 6:19 am
Answers: 0

Re: Primal Script intermittently corrupts files during transfer

Post by pa_cle »

We installed the latest version of PrimalScript 8.1.214
When uploading a file to our development server, if the file already exists on our server, the uploaded file is corrupt.
If the file does not exist on the server, the uploaded file seems to be correct.
Any ideas as to what we can look for ?
Thanks
User avatar
Alexander Riedel
Posts: 859
Last visit: Wed Jul 01, 2026 9:50 am
Answers: 10
Been upvoted: 49 times

Re: Primal Script intermittently corrupts files during transfer

Post by Alexander Riedel »

Are you getting any error messages at all?
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
pa_cle
Posts: 12
Last visit: Mon Jun 22, 2026 6:19 am
Answers: 0

Re: Primal Script intermittently corrupts files during transfer

Post by pa_cle »

We see no errors on the screen.
When we right click the file and choose 'Upload' - the small FTP File Transfer pop-up window appears and disappears (this is the normal process we are use to seeing) and
normally the pop-up isn't there long enough to see what it says.
Today, even if we remove the file on the server before uploading the file. The result is still a corrupt file.
If you would like to connect to my PC and watch the process, check anything out, we can setup a time - if that is an option.
User avatar
Alexander Riedel
Posts: 859
Last visit: Wed Jul 01, 2026 9:50 am
Answers: 10
Been upvoted: 49 times

Re: Primal Script intermittently corrupts files during transfer

Post by Alexander Riedel »

I don't need to watch, I completely believe you are seeing what you are seeing. :D If anything, having access to your ftp server for debugging could possibly help.

I have tried every possible scenario I could think of to make this happen here, unfortunately to no avail.
You say this started when you upgraded to 2025 but you als say this started mid-December. The 2025 version was released January 15th, so that cannot have been causing this mid-December. The FTP code has not changed in years, so I doubt it was any recent update to PrimalScript. Now, it is quite possible that there was a bug lurking for a long time that was brought out now by some other thing that happened. At any rate, we cannot really determine the exact cause from staring at code or watching uploads fail on your side and not on my side.

I have added to more output to the next build, where you can see the files being transmitted and what sizes. Check the sizes carefully if you see anything corrupted.
FTP Output.png
I will try to get that out as soon as possible.

You never answered this question:
2. Is it at all possible that some other process is potentially opening, modifying or saving that file while it is being transferred? This can be an autosave, even in PrimalScript,
some backup tool, version control, someone else editing that file if it is on a server or network location. Anything.

Please think about those possible sources of interaction.

Additionally I would like to get some more information on the following:
- Is this happening from one machine, a few machines or all machines where you use PrimalScript? If only one, have you tried another?
- Are you or someone else using another editor to change files before they get uploaded? (I'll get to details later)
- Do you only experience this only on upload or on download as well? Assuming you do download files on occasion.

I am asking about other editors because with text files a stray ^Z (EOF) or null character within a file may not show up when editing the file in PrimalScript, it filters these things.
But it may throw off the ftp transfer, blindside another editor or other assorted effects. Since something like this would likely not survive zipping files I would not see that in your sample files you uploaded.
If this happens again, look at the source file in PrimalScript in hex mode (open as binary file) and look at the spot where it cuts off if you see strange characters there.
You do not have the required permissions to view the files attached to this post.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Alexander Riedel
Posts: 859
Last visit: Wed Jul 01, 2026 9:50 am
Answers: 10
Been upvoted: 49 times

Re: Primal Script intermittently corrupts files during transfer

Post by Alexander Riedel »

The build with the additional output was released. Please give it a try and let me know what it shows.
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 1 year and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.