Skip to content

Commit 8502d69

Browse files
authored
Fix/bugs (#1434)
* fix: gitops config path can have dirs * fix: domain value for system use popup
1 parent f3521f4 commit 8502d69

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

runWebpack.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ gitops_config() {
108108
cp $copySource/*.* $copyDest/
109109
else
110110
echo "INFO: gitops_config - no $copySource in gitops"
111-
rm -f $copyDest
111+
rm -rf $copyDest
112112
fi
113113
done
114114
fi

src/Popup/SystemUseWarningPopup.jsx

+4-9
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,24 @@ import { connect } from 'react-redux';
33
import PropTypes from 'prop-types';
44
import Popup from '../components/Popup';
55
import { components } from '../params';
6-
import { hostname } from '../localconf';
6+
import { hostnameWithSubdomain } from '../localconf';
77
import { updateSystemUseNotice } from '../actions';
88

99
const handleAcceptWarning = () => {
1010
/**
1111
* If policy is accepted then set systemUseWarnPopup to false, hiding the
1212
* warning.
1313
*/
14-
// set a new cookie indicating we have accepted this policy
15-
16-
const hostnameParts = hostname.split('.');
17-
const hLen = hostnameParts.length;
18-
const hostnameNoSubdomain = (hLen > 2) ? hostnameParts.splice(hLen - 2).join('.') : hostname;
19-
const domain = hostnameNoSubdomain.endsWith('/') ? hostnameNoSubdomain.slice(0, -1) : hostnameNoSubdomain;
2014

15+
// set a new cookie indicating we have accepted this policy
2116
const expiry = new Date();
2217
const defaultDays = 'expireUseMsgDays' in components.systemUse ? components.systemUse.expireUseMsgDays : 0;
2318

2419
if (defaultDays === 0) { // session cookie
25-
document.cookie = `systemUseWarning=yes; expires=0; path=/; domain=.${domain}`;
20+
document.cookie = `systemUseWarning=yes; expires=0; path=/; domain=${hostnameWithSubdomain}`;
2621
} else {
2722
expiry.setTime(expiry.getTime() + (defaultDays * 1440 * 1 * 60 * 1000)); // number of days
28-
document.cookie = `systemUseWarning=yes; expires=${expiry.toGMTString()}; path=/; domain=.${domain}`;
23+
document.cookie = `systemUseWarning=yes; expires=${expiry.toGMTString()}; path=/; domain=${hostnameWithSubdomain}`;
2924
}
3025

3126
return (dispatch) => dispatch(updateSystemUseNotice(false));

0 commit comments

Comments
 (0)