You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/scripts/validate-structure.js
+28Lines changed: 28 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,34 @@ function validateFilePath(filePath) {
49
49
constnormalized=filePath.replace(/\\/g,'/');
50
50
constsegments=normalized.split('/');
51
51
52
+
// Check for invalid characters that break local file systems
53
+
for(leti=0;i<segments.length;i++){
54
+
constsegment=segments[i];
55
+
56
+
// Check for trailing periods (invalid on Windows)
57
+
if(segment.endsWith('.')){
58
+
return`Invalid folder/file name '${segment}' in path '${normalized}': Names cannot end with a period (.) as this breaks local file system sync on Windows.`;
59
+
}
60
+
61
+
// Check for trailing spaces (invalid on Windows)
62
+
if(segment.endsWith(' ')){
63
+
return`Invalid folder/file name '${segment}' in path '${normalized}': Names cannot end with a space as this breaks local file system sync on Windows.`;
return`Invalid folder/file name '${segment}' in path '${normalized}': '${nameWithoutExt}' is a reserved name on Windows and will break local file system sync.`;
71
+
}
72
+
73
+
// Check for invalid characters (Windows and general file system restrictions)
74
+
constinvalidChars=/[<>:"|?*\x00-\x1F]/;
75
+
if(invalidChars.test(segment)){
76
+
return`Invalid folder/file name '${segment}' in path '${normalized}': Contains characters that are invalid on Windows file systems (< > : " | ? * or control characters).`;
commentBody += `Your contribution contains file or folder names that will break when syncing to local file systems (especially Windows):\n\n`;
104
+
commentBody += `\`\`\`\n${output}\n\`\`\`\n\n`;
105
+
commentBody += `**Common issues:**\n`;
106
+
commentBody += `- Folder/file names ending with a period (.) - not allowed on Windows\n`;
107
+
commentBody += `- Folder/file names ending with spaces - not allowed on Windows\n`;
108
+
commentBody += `- Reserved names like CON, PRN, AUX, NUL, COM1-9, LPT1-9 - not allowed on Windows\n`;
109
+
commentBody += `- Invalid characters: < > : " | ? * or control characters\n\n`;
110
+
commentBody += `Please rename these files/folders to be compatible with all operating systems.\n\n`;
111
+
} else {
112
+
commentBody += `As a reminder, the general requirements (as outlined in the [CONTRIBUTING.md file](https://github.com/ServiceNowDevProgram/code-snippets/blob/main/CONTRIBUTING.md)) are the following: follow the folder+subfolder guidelines and include a README.md file explaining what the code snippet does.\n\n`;
commentBody += `Review your contribution against the guidelines and make the necessary adjustments. Closing this for now. Once you make additional changes, feel free to re-open this Pull Request or create a new one.`;
117
+
90
118
await github.rest.issues.createComment({
91
119
owner,
92
120
repo,
93
121
issue_number: pullNumber,
94
-
body: `Thank you for your contribution. However, it doesn't comply with our contributing guidelines. As a reminder, the general requirements (as outlined in the [CONTRIBUTING.md file](https://github.com/ServiceNowDevProgram/code-snippets/blob/main/CONTRIBUTING.md)) are the following: follow the folder+subfolder guidelines and include a README.md file explaining what the code snippet does. Review your contribution against the guidelines and make the necessary adjustments. Closing this for now. Once you make additional changes, feel free to re-open this Pull Request or create a new one.`.trim()
In Client Scripts, oldValue will display the value of last value/record which is stored in that field.
2
+
For new records, it is generally empty and for existing records it displays the value which is stored after load.
3
+
If we will try to change the value in that field, it will still show oldValue the same value which was there during the load of form.
4
+
5
+
So, In order to identify the oldValue on change(as it does in business rule(previous)), This script comes handy and also it will
6
+
detect the action performed.
7
+
8
+
9
+
This onChange Client script comes handy when dealing with Glide List type fields where we have to detect whether the value was added or removed and returns the display name of users who were added/removed along with name of operation performed.
Adding [Bryan Rovell], It shows the operation was addition, oldValue as 'No record found' as there was no value earlier.New Value shows the name of the user (Bryan Rovell)
0 commit comments