Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7615619
Fix data region column name references (#2526)
labkey-tchad Jul 2, 2025
38b3bed
Add EntityBulkUpdateDialog.getSelectionFieldHelpBlockText() (#2531)
labkey-nicka Jul 3, 2025
98c705c
Alan's 25.7 Issues (#2535)
labkey-alan Jul 3, 2025
39f09ec
Use OS-specific file separator for expected file paths (#2536)
labkey-tchad Jul 3, 2025
645e434
Add test for "Reset" email notifications settings (#2534)
labkey-adam Jul 5, 2025
f46ec8a
Issue 53394: FileInput revert removal of the "-fileUpload" suffix fro…
cnathe Jul 7, 2025
3b57c5e
Merge 25.3 to 25.7
labkey-klum Jul 8, 2025
77aea55
A couple more CSP enhancements (#2530)
labkey-tchad Jul 8, 2025
b9e62b7
Merge 25.3 to release25.7-SNAPSHOT (#2539)
labkey-teamcity Jul 8, 2025
a3968ce
Avoid generating fields names with reserved substitution format patte…
labkey-tchad Jul 9, 2025
7bc7243
Use `WebElement.getDomProperty` for element `src` (#2538)
labkey-tchad Jul 9, 2025
6e4d1ba
Create `TestFileUtils.getMD5Hash` to compare binary files (#2547)
labkey-tchad Jul 9, 2025
efbfd7b
Allow `ScriptReportPage.saveReport` to return `null` (#2546)
labkey-tchad Jul 9, 2025
787d439
Issue 53408: Encode field names in attachment download links (#2543)
labkey-susanh Jul 10, 2025
df5ce63
Prevent `StringIndexOutOfBoundsException` when generating field names…
labkey-tchad Jul 10, 2025
d2939f9
Compare thumbnail files instead of stringifying them (#2555)
labkey-tchad Jul 11, 2025
6fc4ab3
Don't disable CSP enforcement for knitr tests (#2554)
labkey-tchad Jul 11, 2025
104debd
Don't crawl actions again after being redirected to them (#2557)
labkey-tchad Jul 12, 2025
1805da6
Increase timeout for getting updated password score (#2558)
labkey-jeckels Jul 13, 2025
5f37d08
Issue 53431: Data Class and Sample Type data doesn't round-trip via f…
cnathe Jul 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions data/reports/knitr_no_scriptpad.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,11 @@ end.rcode-->
<p>Well, everything seems to be working. Let's ask R what is the
value of &pi;? Of course it is <!--rinline pi -->.</p>

<span>Nonce check: <span id="nonce-check-result">FAIL</span></span>

<script>
document.getElementById('nonce-check-result').innerText = "SUCCESS";
</script>

</body>
</html>
6 changes: 6 additions & 0 deletions data/reports/knitr_no_scriptpad.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ library(knitr)
knit('knitr-minimal.Rmd')
```

<span>Nonce check: <span id="nonce-check-result">FAIL</span></span>

<script>
document.getElementById('nonce-check-result').innerText = "SUCCESS";
</script>

## Conclusion

Markdown is super easy to write. Go to **knitr** [homepage](http://yihui.name/knitr) for details.
15 changes: 15 additions & 0 deletions data/reports/nonce_check.rhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Test script nonce in Knitr HTML</title>
</head>
<body>

<span>Nonce check: <span id="nonce-check-result">FAIL</span></span>

<script>
document.getElementById('nonce-check-result').innerText = "SUCCESS";
</script>

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,11 @@ end.rcode-->
<p>Well, everything seems to be working. Let's ask R what is the
value of &pi;? Of course it is <!--rinline pi -->.</p>

<span>Nonce check: <span id="nonce-check-result">FAIL</span></span>

<script>
document.getElementById('nonce-check-result').innerText = "SUCCESS";
</script>

</body>
</html>
6 changes: 6 additions & 0 deletions modules/scriptpad/resources/reports/schemas/script_rmd.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ library(knitr)
knit('knitr-minimal.Rmd')
```

<span>Nonce check: <span id="nonce-check-result">FAIL</span></span>

<script>
document.getElementById('nonce-check-result').innerText = "SUCCESS";
</script>

## Conclusion

Markdown is super easy to write. Go to **knitr** [homepage](http://yihui.name/knitr) for details.
47 changes: 43 additions & 4 deletions src/org/labkey/test/TestFileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,14 @@ public static String getFileContents(final File file)
return getFileContents(path);
}

/**
* Get text content of a file. Will throw an error for non-text files (e.g. PDF).
*/
public static String getFileContents(Path path)
{
try
{
return new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
return Files.readString(path);
}
catch (IOException fail)
{
Expand Down Expand Up @@ -306,7 +309,7 @@ public static Set<File> getSampleDataDirs()
if (sampledataDirsFile.exists())
{
String path = getFileContents(sampledataDirsFile);
_sampledataDirs.addAll(Arrays.stream(path.split(";")).map(File::new).collect(Collectors.toList()));
_sampledataDirs.addAll(Arrays.stream(path.split(";")).map(File::new).toList());
}
else
{
Expand All @@ -317,7 +320,7 @@ public static Set<File> getSampleDataDirs()
// We know where the modules live; no reason to insist that sampledata.dirs exists.
Files.walkFileTree(modulesDir, Collections.emptySet(), 2, new SimpleFileVisitor<>(){
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException
public @NotNull FileVisitResult preVisitDirectory(@NotNull Path dir, @NotNull BasicFileAttributes attrs)
{
if (dir.equals(modulesDir))
{
Expand Down Expand Up @@ -352,10 +355,46 @@ public static File getTestTempDir()
return new File(buildDir, "testTemp");
}

public static File ensureTestTempDir() throws IOException
/**
* Creates a directory under the 'testTemp' directory: 'build/testTemp/[children]'
* @param children will be appended to the testTemp path
* @return A file pointer to the specified directory. The directory will exist
* @throws IOException if the directories were not created
*/
public static File ensureTestTempDir(String... children) throws IOException
{
File file = getTestTempDir();
for (String child : children)
{
file = new File(file, child);
}

FileUtils.forceMkdir(file);

return file;
}

/**
* Creates a directory under the 'testTemp' directory to contain the specified file. 'build/testTemp[/children]/lastChild'
* @param children will be appended to the testTemp path to construct the desired file's path
* @return A file pointer to the specified file. The file's parents will exist but the file might not
* @throws IOException if the parent directories were not created
*/
public static File ensureTestTempFile(String... children) throws IOException
{
File file = getTestTempDir();

for (String child : children)
{
file = new File(file, child);
}

if (file.toString().length() == getTestTempDir().toString().length())
{
throw new IllegalArgumentException("No valid children were provided: " + Arrays.toString(children));
}
FileUtils.forceMkdirParent(file);

return file;
}

Expand Down
Loading