Skip to content

Commit

Permalink
fixed usage of ampersand in AJAX
Browse files Browse the repository at this point in the history
  • Loading branch information
threadi committed Mar 6, 2024
1 parent b28d1a4 commit ac69640
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions admin/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ jQuery(document).ready(function($) {
// get button as object
let button_obj = $(this);

// get field value
// get field value.
let urls = $(this).parent().find('.eml_add_external_files').val();

// do nothing if list is empty.
if( urls.length === 0 ) {
return;
}

// send request
// send request.
jQuery.ajax({
url: emlJsVars.ajax_url,
type: 'post',
Expand Down
1 change: 1 addition & 0 deletions inc/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ function eml_admin_add_urls_via_ajax(): void {
$files = array();
foreach ( $url_array as $url ) {
if ( ! empty( $url ) ) {
$url = str_replace( '&', '&', $url );
if ( ! $files_obj->add_file( $url ) ) {
$errors[] = $url;
} else {
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ No, only public files can be used.

= 1.1.2 =
* Fixed possible error during check for current screen
* Fixed usage of URLs with ampersand on AJAX-request

0 comments on commit ac69640

Please sign in to comment.