Accurate detection of leakage is the key to reduce the leakage rate of water distribution networks. This paper proposes a leakage detection method based on a semi-fixed-length sliding window. The method uses a sliding window to detect leakages by analyzing the time series flow data and improves the information quality of the acquired data with a variable-length window, in which the length of the window is limited. Based on Clustering by Fast Search and Find of Density Peaks（CFSFDP），the entropy function is introduced to adaptively select cutoff distance parameters according to the data distribution characteristics. In this way, the detection rate of leakage events is improved. The experimental results show that the proposed algorithm can effectively detect the leakage data in the four simulated scenarios, and obtain a higher leakage detection rate and a lower false alarm rate.