Skip to content

on delete TypeError: text.replace is not a function fileinput.js #1536

@Bintux

Description

@Bintux

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest master branch of bootstrap-fileinput.
  • This is not an usage question. I confirm having read the plugin documentation and demos.
  • This is not a general programming / coding question. (Those should be directed to the webtips Q & A forum).
  • I have attempted to find the simplest possible steps to reproduce the issue.
  • I have included a failing test as a pull request (Optional).

Expected behavior and actual behavior

When using the delete function and my back-end page returns an error in the described json format: {error: BOOLEAN_VALUE} I get the error :

JSON	
error	true
Preview	
Response Payload	

1

{"error":true}

2


TypeError: text.replace is not a function fileinput.js:2082:36

fileinput.js:2082 Uncaught TypeError: text.replace is not a function
    at FileInput._parseError (fileinput.js:2082)
    at Object.fnSuccess [as success] (fileinput.js:3626)
    at i (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at A (jquery.min.js:4)
    at XMLHttpRequest.<anonymous> (jquery.min.js:4)
    at Object.send (jquery.min.js:4)
    at Function.ajax (jquery.min.js:4)
    at HTMLButtonElement.<anonymous> (fileinput.js:3682)
    at HTMLButtonElement.dispatch (jquery.min.js:3)


Environment

Browsers

  • Google Chrome
  • Mozilla Firefox
  • Internet Explorer
  • Safari

Operating System

  • Windows
  • Mac OS X
  • Linux
  • Mobile

Libraries

  • jQuery version: 3.2.1
  • bootstrap-fileinput version: version: 5.0.8

Isolating the problem

  • This bug happens on the plugin demos page
  • The bug happens consistently across all tested browsers
  • This bug happens when using bootstrap-fileinput without other plugins
  • I can reproduce this bug in a jsbin

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions