https://bugs.kde.org/show_bug.cgi?id=390328

            Bug ID: 390328
           Summary: KIO AccessManager breaks QML's XMLHttpRequest
           Product: frameworks-kio
           Version: 5.43.0
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: fa...@kde.org
          Reporter: sit...@kde.org
                CC: kdelibs-b...@kde.org
  Target Milestone: ---

Created attachment 110567
  --> https://bugs.kde.org/attachment.cgi?id=110567&action=edit
example app

When using KDeclarative it will set KIO's AcessManager as QmlNAM, after that
the builtin XMLHttpRequest qml type can no longer (over)write existing file://
locations.

Simple example attached.

With the builtin NAM you can do

```
                var xhr = new XMLHttpRequest;
                xhr.open("PUT", "file:///tmp/test.json");
                xhr.send(new Date().toISOString());
```

in qml.
With the KIO one this runs through the file slave, which will perform an
overwrite check in `FileProtocol::put`. That's fine if the file doesn't exist,
when trying to update an existing file that aborts the put with
ERR_FILE_ALREADY_EXIST and no data written.


```
    if (bOrigExists && !(_flags & KIO::Overwrite) && !(_flags & KIO::Resume)) {
        if ((buff_orig.st_mode & QT_STAT_MASK) == QT_STAT_DIR) {
            error(KIO::ERR_DIR_ALREADY_EXIST, dest_orig);
        } else {
            error(KIO::ERR_FILE_ALREADY_EXIST, dest_orig);
        }
        return;
    }
```

The attached example writes the current datetime to /tmp/test.json when
clicking the save button, this fails top update the stamp after the first
write.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to