Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: escape html string before v-html (#549)
  • Loading branch information
boojack committed Feb 11, 2022
1 parent 14b05a8 commit 9ee9290
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Expand Up @@ -72,6 +72,7 @@
</template>

<script lang="ts" setup>
import { escape } from "lodash-es";
import { computed, reactive } from "vue";
import { useI18n } from "vue-i18n";
import { useClipboard } from "@vueuse/core";
Expand Down Expand Up @@ -140,8 +141,11 @@ const data = computed(() => {
return {
...history,
formatedStatement: state.search
? getHighlightHTMLByKeyWords(history.statement, state.search)
: history.statement,
? getHighlightHTMLByKeyWords(
escape(history.statement),
escape(state.search)
)
: escape(history.statement),
};
});
});
Expand Down
15 changes: 11 additions & 4 deletions frontend/src/views/SqlEditor/AsidePanel/SavedQueryContainer.vue
Expand Up @@ -93,6 +93,7 @@
</template>

<script lang="ts" setup>
import { escape } from "lodash-es";
import { computed, reactive, ref, nextTick } from "vue";
import { useI18n } from "vue-i18n";
import {
Expand Down Expand Up @@ -178,11 +179,17 @@ const data = computed(() => {
return {
...savedQuery,
formatedName: state.search
? getHighlightHTMLByKeyWords(savedQuery.name, state.search)
: savedQuery.name,
? getHighlightHTMLByKeyWords(
escape(savedQuery.name),
escape(state.search)
)
: escape(savedQuery.name),
formatedStatement: state.search
? getHighlightHTMLByKeyWords(savedQuery.statement, state.search)
: savedQuery.statement,
? getHighlightHTMLByKeyWords(
escape(savedQuery.statement),
escape(state.search)
)
: escape(savedQuery.statement),
};
});
});
Expand Down

0 comments on commit 9ee9290

Please sign in to comment.