Can't upload to public link after php update

Nextcloud version: 20.0.8
Operating system and version: centos 8
Apache: 2.4.6
PHP version: 7.4

Since I updated php from 7.2 to 7.4, I can no longer upload to nextcloud public link using curl as I used to. I am getting the following response:

<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="">
  <s:message>Cannot authenticate over ajax calls</s:message>

Here is how I do the upload with curl:

curl -k -T file.txt -u "{link_end}:{password}" -H 'X-Requested-With: XMLHttpRequest'

Nothing shows up in the logs unfortunately.

After looking into the code, I found in PublicAuth.php:

if (in_array('XMLHttpRequest', explode(',', $this->request->getHeader('X-Requested-With')))) {
        // do not re-authenticate over ajax, use dummy auth name to prevent browser popup
        header('WWW-Authenticate','DummyBasic realm="' . $this->realm . '"');
        throw new \Sabre\DAV\Exception\NotAuthenticated('Cannot authenticate over ajax calls');
return false;

So I commented that out to return true to see and then got username/password incorrect. I then set the password of that public link again and it then started to work… Unfortunately for me it seems I have to set the password of all my public links again.