diff --git a/fastqc.wdl b/fastqc.wdl
index 630ee15c00bba7266f2f14de85abe468f7dc0f53..657c7929e2f4afb68cf32def2a158fab1ed98d5d 100644
--- a/fastqc.wdl
+++ b/fastqc.wdl
@@ -40,10 +40,11 @@ task fastqc {
     }
 
     output {
-        # Apparently, the escape character needs to be escaped in regexes.
+        # Chops of the .gz extension if present.
+        String name = sub(seqFile, "\\.gz$","")
         # This regex chops of the extension and replaces it with _fastqc for the reportdir.
         # Just as fastqc does it.
-        String reportDir = outdirPath + "/" + sub(basename(seqFile), "\\.[^\\.]*$", "_fastqc")
+        String reportDir = outdirPath + "/" + sub(basename(name), "\\.[^\\.]*$", "_fastqc")
         File rawReport = reportDir + "/fastqc_data.txt"
         File htmlReport = reportDir + "/fastqc_report.html"
         File summary = reportDir + "/summary.txt"