Commit 4f58b518 authored by Liang Ding's avatar Liang Ding

新增 Markdown zip 导入方式 Fix #128

parent 906b219e
......@@ -54,7 +54,7 @@ import java.util.*;
* Admin console render processing.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.0.0.0, Feb 9, 2020
* @version 2.0.0.1, May 21, 2020
* @since 0.4.1
*/
@Singleton
......@@ -233,9 +233,12 @@ public class AdminConsole {
*/
public void importMarkdownZip(final RequestContext context) {
context.renderJSON();
final Request request = context.getRequest();
final FileUpload file = request.getFileUpload("file");
if (null == file) {
context.renderMsg(langPropsService.get("allowZipOnlyLabel"));
return;
}
final String fileName = file.getFilename();
String suffix = StringUtils.substringAfterLast(fileName, ".");
if (!StringUtils.equalsIgnoreCase(suffix, "zip")) {
......
This diff is collapsed.
......@@ -14,7 +14,7 @@
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.4.1.0, Apr 2, 2020
* @version 1.4.1.1, May 21, 2020
*/
/* others 相关操作 */
......@@ -134,7 +134,7 @@ admin.others = {
importZip () {
const formData = new FormData()
const $input = $('#otherImportFileInput')
formData.append('file', $input[0].files)
formData.append('file', $input[0].files[0])
$.ajax(Label.servePath + '/console/import/markdown-zip', {
method: 'POST',
data: formData,
......@@ -142,6 +142,7 @@ admin.others = {
contentType: false,
success: function (res) {
$input.val('')
$('#tipMsg').text(res.msg)
},
complete: function () {
$input.val('')
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment