Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Image. Server replied: Not Acceptable



  • I am allowing my users to add images as attachments, so the user provides a link, and I set it to the 'Image' item. But for some servers I get this error:

    qrc:/AttachmentList.qml:40:25: QML Image: Error transferring http://doggiedonyc.com/wp-content/uploads/2014/06/dog2.jpg - server replied: Not Acceptable

    Investigating further, I found that this is some problem with User-Agent string. But how do I change this value if I don't have access to QML internals?

    My QML source goes like this:

                        ```
                    Image {
                            id: attach_img
                            source:  (model.type===Attachments.A_TYPE_IMAGE) || (model.type===Attachments.A_TYPE_YOUTUBE) ? model.display_url : ""
                            width: app.width  * 0.9
                            fillMode: Image.PreserveAspectFit
                        }
    
    
    TIA


  • Hi @Nulik , i think the user-agent string needs a valid value,i guess QQmlNetworkAccessManagerFactory Class can you help you in that,you can have look into the documentation [https://doc.qt.io/qt-5/qqmlnetworkaccessmanagerfactory.html].


Log in to reply