Jump to content

File Upload fails when no Superuser


SebastianP
 Share

Recommended Posts

Hi,

when I try to upload an image with non-Superuser role, the spinner does nor disappear and the upload dont get finished.
I get an error in .../wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js:

"VM1186:1 Uncaught SyntaxError: Unexpected token '<', "<script>"...

The message which is returned as XHP-response is:

<script>
$(document).ready(function() {
	$("#_ProcessPageEditViewDropdown").remove();
});
</script>

And this breaks the json parsing of this response.

What's going wrong here?

Thank you, best regards
Sebastian

Link to comment
Share on other sites

Hi, we need more details. Modules, Version, logs, etc.

Essentially this sort of issue arise when html markup is returned before the JSON result expected, then the xhr fail. My bet is that you have a hook somewhere, do you have something related in ready.php or _init.php or admin.php ?

  • Like 2
Link to comment
Share on other sites

I've found the reason. The module "Restrict Tab View", especially the activation of the "tab-view-hide"-permission causes this behaviour. After deactivting this option, the upload works again.

Best regards
Sebastian

  • Like 3
Link to comment
Share on other sites

@SebastianP if you really need the module, you can try to check xhr (I can't confirm the behavior..):

if (!$this->config->ajax) { // add this

  if(in_array('View', $this->hiddenTabs)) {
    $event->return .= '
      <script>
        $(document).ready(function() {
          $("#_ProcessPageEditViewDropdown").remove();
        });
      </script>';
  }

} // <-- add this

https://github.com/adrianbj/RestrictTabView/blob/88bbee5a1fbf9a52e16df8573c0a243ee9feca97/RestrictTabView.module.php#L72-L79

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...