Browse Source

URI encoding 100%

master
RENOX 4 months ago
parent
commit
eb3ff72c39
3 changed files with 7 additions and 5 deletions
  1. +4
    -1
      src/main/java/planetrenox/controller/FormController.java
  2. +2
    -2
      src/main/java/planetrenox/controller/RequestValidation.java
  3. +1
    -2
      src/main/resources/static/js/main.js

+ 4
- 1
src/main/java/planetrenox/controller/FormController.java View File

@@ -1,12 +1,15 @@
package planetrenox.controller;

import lombok.NonNull;
import org.springframework.aop.scope.ScopedProxyUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import planetrenox.encryption.AES256_GCM;
import planetrenox.mongodb.Dungeon;
import planetrenox.mongodb.DungeonRepository;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Map;

@RestController
@@ -60,7 +63,7 @@ public class FormController
*/
@PostMapping(path = "/", params = {"name", "password", "text", "tabs"})
public Map<String, Object> save
(@NonNull @RequestParam("name") final String name, @NonNull @RequestParam("password") final String password, @NonNull @RequestParam("text") final String text, @RequestParam("tabs") final int tabs)
(@NonNull @RequestParam("name") final String name, @NonNull @RequestParam("password") final String password, @NonNull @RequestParam("text") final String text, @RequestParam("tabs") final int tabs) throws UnsupportedEncodingException
{
Map<String, Object> saveDocument = RequestValidation.validateSave(name, password, text, tabs);
if ((boolean) saveDocument.get("INVALID")) return saveDocument; // Validation Failed


+ 2
- 2
src/main/java/planetrenox/controller/RequestValidation.java View File

@@ -64,7 +64,7 @@ public class RequestValidation
));

saveDocument.put("CLEAN_NAME", Jsoup.clean(name, Whitelist.simpleText()));
saveDocument.put("CLEAN_TEXT", Jsoup.clean(text, Whitelist.basic()));
saveDocument.put("CLEAN_TEXT", Jsoup.clean(text, Whitelist.basic()).replaceAll("&amp;", "&"));

if (name.length() > 60)
{
@@ -106,7 +106,7 @@ public class RequestValidation
));

saveDocument.put("CLEAN_NAME", Jsoup.clean(name, Whitelist.simpleText()));
saveDocument.put("CLEAN_TEXT", Jsoup.clean(text, Whitelist.basic()));
saveDocument.put("CLEAN_TEXT", Jsoup.clean(text, Whitelist.basic()).replaceAll("&amp;", "&"));

if (name.length() > 60)
{


+ 1
- 2
src/main/resources/static/js/main.js View File

@@ -274,8 +274,7 @@ function populateFormLocalEvent(responseJson) {
document.getElementById("password-form").style.display = "none";
document.getElementById("btn-logout").style.display = "inherit";
document.getElementById("btn-settings").style.display = "inherit";
// TODO NOT DECODING CORRECTLY
let entireTextArray = decodeURIComponent(responseJson.DUNGEON.cleartext).split("|textdungeon-tab|");
let entireTextArray = responseJson.DUNGEON.cleartext.split("|textdungeon-tab|");
for (let i = 0; i < responseJson.DUNGEON.meta.TAB_COUNT; i++) {
if (i !== 0) initAddTab();
tabContent.set("tab" + (i + 1), entireTextArray[i]);


Loading…
Cancel
Save