Skip to content

Commit

Permalink
fix: trim and auto-remove trailing slash for Site URL in Admin General
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Apr 24, 2020
1 parent 7c59bfe commit ec2d10c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/components/admin/admin-auth.vue
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
inset
)

v-card.mt-4.wiki-form.animated.fadeInUp.wait-p4s
v-card.mt-4.wiki-form.animated.fadeInUp.wait-p4s(v-if='selectedStrategy !== `local`')
v-toolbar(color='primary', dense, flat, dark)
.subtitle-1 {{$t('admin:auth.configReference')}}
v-card-text
Expand Down
13 changes: 9 additions & 4 deletions server/graph/resolvers/site.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const graphHelper = require('../../helpers/graph')
const _ = require('lodash')

/* global WIKI */

Expand All @@ -25,18 +26,22 @@ module.exports = {
},
SiteMutation: {
async updateConfig(obj, args, context) {
let siteHost = _.trim(args.host)
if (siteHost.endsWith('/')) {
siteHost = siteHost.splice(0, -1)
}
try {
WIKI.config.host = args.host
WIKI.config.title = args.title
WIKI.config.company = args.company
WIKI.config.host = siteHost
WIKI.config.title = _.trim(args.title)
WIKI.config.company = _.trim(args.company)
WIKI.config.contentLicense = args.contentLicense
WIKI.config.seo = {
description: args.description,
robots: args.robots,
analyticsService: args.analyticsService,
analyticsId: args.analyticsId
}
WIKI.config.logoUrl = args.logoUrl
WIKI.config.logoUrl = _.trim(args.logoUrl)
WIKI.config.features = {
featurePageRatings: args.featurePageRatings,
featurePageComments: args.featurePageComments,
Expand Down

0 comments on commit ec2d10c

Please sign in to comment.