Skip to content

Commit

Permalink
Fixed an issue where default EOL in the query tool should be based on…
Browse files Browse the repository at this point in the history
… the OS. #7393
  • Loading branch information
RohitBhati8269 authored Oct 3, 2024
1 parent 33c88ce commit d736f42
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions web/pgadmin/static/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -736,3 +736,16 @@ export const memoizeTimeout = (fn, time) => new Proxy(fn, {
return result;
}
});

export function getPlatform() {
const platform = navigator.userAgent;
if (platform.includes('Win')) {
return 'Windows';
} else if (platform.includes('Mac')) {
return 'Mac';
} else if (platform.includes('Linux')) {
return 'Linux';
} else {
return 'Unknown';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//
//////////////////////////////////////////////////////////////
import gettext from 'sources/gettext';
import { getPlatform } from '../../../../../static/js/utils';

export const QUERY_TOOL_EVENTS = {
TRIGGER_STOP_EXECUTION: 'TRIGGER_STOP_EXECUTION',
Expand Down Expand Up @@ -113,4 +114,4 @@ export const PANELS = {

export const MAX_QUERY_LENGTH = 1000000;

export const OS_EOL = navigator.platform === 'win32' ? 'crlf' : 'lf';
export const OS_EOL = getPlatform() === 'Windows' ? 'crlf' : 'lf';

0 comments on commit d736f42

Please sign in to comment.