Skip to content

Issue : Missing Error Handling in renamefile function #66

@PrinceSajjadHussain

Description

@PrinceSajjadHussain

The renamefile function doesn't handle potential errors returned from the xHttp.request call. While the callback renameFileCallback does handle errors and reverts the input field, the renamefile function itself proceeds regardless of success or failure which can lead to unexpected behavior or a confusing UI if the rename fails silently.

function renamefile(id) {
    document.getElementById("navn" + id + "form").style.display = "none";
    document.getElementById("navn" + id + "div").style.display = "";
    var payload = {"name": document.getElementById("navn" + id + "form").firstChild.firstChild.value};
    document.getElementById("loading").style.visibility = "";
    xHttp.request("/admin/explorer/files/" + id + "/", renameFileCallback, "PUT", payload);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions