Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BudgetMaster
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robert Goldmann
BudgetMaster
Commits
bbf121f6
There was a problem fetching the pipeline summary.
Commit
bbf121f6
authored
Jun 16, 2018
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
Fixed #311 - encode exported databases in utf-8
parent
2817c846
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/de/deadlocker8/budgetmaster/controller/SettingsController.java
+20
-12
20 additions, 12 deletions
...adlocker8/budgetmaster/controller/SettingsController.java
src/main/resources/templates/settings.ftl
+1
-1
1 addition, 1 deletion
src/main/resources/templates/settings.ftl
with
21 additions
and
13 deletions
src/main/java/de/deadlocker8/budgetmaster/controller/SettingsController.java
+
20
−
12
View file @
bbf121f6
...
@@ -26,6 +26,7 @@ import tools.RandomCreations;
...
@@ -26,6 +26,7 @@ import tools.RandomCreations;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
@Controller
@Controller
...
@@ -95,24 +96,31 @@ public class SettingsController extends BaseController
...
@@ -95,24 +96,31 @@ public class SettingsController extends BaseController
{
{
LOGGER
.
debug
(
"Exporting database..."
);
LOGGER
.
debug
(
"Exporting database..."
);
String
data
=
databaseService
.
getDatabaseAsJSON
();
String
data
=
databaseService
.
getDatabaseAsJSON
();
try
{
byte
[]
dataBytes
=
data
.
getBytes
(
"UTF8"
);
String
fileName
=
"BudgetMasterDatabase_"
+
DateTime
.
now
().
toString
(
"yyyy_MM_dd"
)
+
".json"
;
String
fileName
=
"BudgetMasterDatabase_"
+
DateTime
.
now
().
toString
(
"yyyy_MM_dd"
)
+
".json"
;
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename=\""
+
fileName
+
"\""
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename=\""
+
fileName
+
"\""
);
response
.
setContentType
(
"application/json"
);
response
.
setContentType
(
"application/json; charset=UTF-8"
);
response
.
setContentLength
(
data
.
length
());
response
.
setContentLength
(
dataBytes
.
length
);
response
.
setCharacterEncoding
(
"UTF-8"
);
try
(
ServletOutputStream
out
=
response
.
getOutputStream
())
try
(
ServletOutputStream
out
=
response
.
getOutputStream
())
{
{
out
.
p
ri
ntln
(
data
);
out
.
w
ri
te
(
data
Bytes
);
out
.
flush
();
out
.
flush
();
LOGGER
.
debug
(
"Exporting database DONE"
);
}
}
catch
(
IOException
e
)
catch
(
IOException
e
)
{
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
LOGGER
.
debug
(
"Exporting database DONE"
);
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
}
}
@RequestMapping
(
"/settings/database/requestDelete"
)
@RequestMapping
(
"/settings/database/requestDelete"
)
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/templates/settings.ftl
+
1
−
1
View file @
bbf121f6
...
@@ -206,7 +206,7 @@
...
@@ -206,7 +206,7 @@
<div class="modal-content">
<div class="modal-content">
<h4>$
{
locale
.getString
(
"info.title.database.import.dialog"
)}
</h4>
<h4>$
{
locale
.getString
(
"info.title.database.import.dialog"
)}
</h4>
<form id="form-database-import" method="POST" action="/settings/database/upload" enctype="multipart/form-data">
<form id="form-database-import" method="POST" action="/settings/database/upload" enctype="multipart/form-data"
accept-charset="UTF-8"
>
<input type="hidden" name="$
{
_
csrf
.parameterName
}
" value="$
{
_
csrf
.token
}
"/>
<input type="hidden" name="$
{
_
csrf
.parameterName
}
" value="$
{
_
csrf
.token
}
"/>
<div class="file-field input-field">
<div class="file-field input-field">
<div class="btn waves-effect waves-light budgetmaster-blue">
<div class="btn waves-effect waves-light budgetmaster-blue">
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment