Przeglądaj źródła

Fix #215: Set default delete method REST compliant

Kartik Visweswaran 10 lat temu
rodzic
commit
26a9f846b0
3 zmienionych plików z 3 dodań i 2 usunięć
  1. 1 0
      CHANGE.md
  2. 2 2
      js/fileinput.js
  3. 0 0
      js/fileinput.min.js

+ 1 - 0
CHANGE.md

@@ -46,6 +46,7 @@ version 4.1.8
 23. (enh #211): Add ability to show detailed server error stack via `showAjaxErrorDetails`.
 23. (enh #211): Add ability to show detailed server error stack via `showAjaxErrorDetails`.
 24. (enh #212): Revamp preview to use a new preview caching object.
 24. (enh #212): Revamp preview to use a new preview caching object.
 25. (enh #213): Code cleanup, eliminate change event on clear and properly reset preview cache after ajax deletes.
 25. (enh #213): Code cleanup, eliminate change event on clear and properly reset preview cache after ajax deletes.
+26. (enh #215): Set default delete method REST compliant.
 
 
 version 4.1.7
 version 4.1.7
 =============
 =============

+ 2 - 2
js/fileinput.js

@@ -907,7 +907,7 @@
                 }
                 }
                 settings = $.extend({
                 settings = $.extend({
                     url: vUrl,
                     url: vUrl,
-                    type: 'POST',
+                    type: 'DELETE',
                     dataType: 'json',
                     dataType: 'json',
                     data: $.extend({key: vKey}, extraData),
                     data: $.extend({key: vKey}, extraData),
                     beforeSend: function (jqXHR) {
                     beforeSend: function (jqXHR) {
@@ -919,7 +919,7 @@
                         index = parseInt($frame.data('fileindex').replace('init_', ''));
                         index = parseInt($frame.data('fileindex').replace('init_', ''));
                         config = isEmpty(cache.config) && isEmpty(cache.config[index]) ? null : cache.config[index];
                         config = isEmpty(cache.config) && isEmpty(cache.config[index]) ? null : cache.config[index];
                         extraData = isEmpty(config) || isEmpty(config.extra) ? deleteExtraData : config.extra;
                         extraData = isEmpty(config) || isEmpty(config.extra) ? deleteExtraData : config.extra;
-                        if (data.error === undefined) {
+                        if (data === undefined || data.error === undefined) {
                             previewCache.unset(self.id, index);
                             previewCache.unset(self.id, index);
                             self.raise('filedeleted', [vKey, jqXHR, extraData]);
                             self.raise('filedeleted', [vKey, jqXHR, extraData]);
                         } else {
                         } else {

Plik diff jest za duży
+ 0 - 0
js/fileinput.min.js


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików