def METHOD_NAME(rotkehlchen_api_server, file_upload):
    """Test that common error handling for uploading custom icons"""
    root_path = Path(__file__).resolve().parent.parent.parent.parent
    filepath = root_path / 'frontend' / 'app' / 'public' / 'assets' / 'images' / 'protocols' / 'kraken.svg'  # noqa: E501
    # Let's also try to upload a file without the csv prefix
    with TemporaryDirectory() as temp_directory:
        bad_filepath = Path(temp_directory) / 'somefile.bad'
        shutil.copyfile(filepath, bad_filepath)
        if file_upload:
            with open(bad_filepath, 'rb') as infile:
                response = requests.post(
                    api_url_for(
                        rotkehlchen_api_server,
                        'asseticonsresource',
                    ),
                    json={'asset': urllib.parse.quote_plus(A_GNO.identifier)},
                    files={'file': infile},
                )
        else:
            json_data = {
                'file': str(bad_filepath),
                'asset': urllib.parse.quote_plus(A_GNO.identifier),
            }
            response = requests.put(
                api_url_for(
                    rotkehlchen_api_server,
                    'asseticonsresource',
                ), json=json_data,
            )
    assert_error_response(
        response=response,
        contained_in_msg=f'does not end in any of {",".join(ALLOWED_ICON_EXTENSIONS)}',
        status_code=HTTPStatus.BAD_REQUEST,
    )